זיהוי ומניעה של השתלטות על חשבונות

בדף הזה מוסבר איך לזהות ולמנוע השתלטות על חשבונות (ATO) באמצעות reCAPTCHA.

מתקפות ATO מתרחשות בדרך כלל כשתוקף שולח בקשות להתחבר לנקודות קצה של API באמצעות פרטי כניסה שהושגו מפרצה באבטחת מידע, שנקראת גם פריצת סיסמאות. התקפה מסוג כזה יכולה להצליח גם אם הסיסמאות נגנבו מאתר לא קשור, כי אנשים נוטים להשתמש באותן סיסמאות בכמה חשבונות. סוג המתקפה הזה לא משפיע על משתמשים שמקפידים על היגיינת סיסמאות נכונה, למשל על ידי שימוש במנהל סיסמאות.

לפני שמתחילים

הכנת הסביבה ל-reCAPTCHA

זיהוי ומניעה של השתלטות על חשבונות

בעזרת reCAPTCHA, אתם יכולים לזהות ולמנוע השתלטות על חשבונות באמצעות אחת מהאפשרויות הבאות:

שימוש בתיבת הסימון 'אני לא רובוט'

הוספת תיבת הסימון אני לא רובוט לאתר היא הדרך הכי מהירה וקלה לספק הגנה מסוימת מפני השתלטות על חשבונות בלי לשלב תכונות נוספות, כמו אימות באמצעות SMS או אימייל. יש עלות לתוקף כדי לפרוץ את ההגנה הזו, והאפשרות הזו עשויה להספיק לחלק מהאתרים.

מוסיפים את תיבת הסימון 'אני לא רובוט' לדפי האינטרנט.

הקוד הבא הוא דוגמה חיה לדף כניסה שמוגן על ידי תיבת הסימון:

function onSuccess(token) {
  // The token is included in the POST data in the g-recaptcha-response
  // parameter. The backend must create an Assessment with the token
  // and verify the token is valid.
  console.log(token);
}
<form id="loginForm" action="?" method="POST">
  Username: <input type="text" name="username"/><br/>
  Password: <input type="password" name="password"/><br/>
  <div class="g-recaptcha" data-sitekey="reCATCHA_sitekey"
       data-action="account_login" data-callback="onSuccess"></div>
</form>
<script src="/https://www.google.com/recaptcha/enterprise.js" async defer></script>

אפשר להתנסות עם הקוד הזה ב-JSFiddle בלחיצה על הסמל <> בפינה השמאלית העליונה של חלון הקוד.

<html>
  <head>
    <title>Account Login - Checkbox</title>
    <script src="/https://www.google.com/recaptcha/enterprise.js" async defer></script>
    <script>
    function onSuccess(token) {
      // The token is included in the POST data in the g-recaptcha-response
      // parameter. The backend must create an Assessment with the token
      // and verify the token is valid.
      console.log(token);
    }
    </script>
  </head>
  <body>
    <form id="loginForm" action="?" method="POST">
      Username: <input type="text" name="username"/><br/>
      Password: <input type="password" name="password"/><br/>
      <div class="g-recaptcha" data-sitekey="6LeAkOgUAAAAACcy3uY6N9H9SJMS27n3Zx2OOnYK"
           data-action="account_login" data-callback="onSuccess"></div>
    </form>
  </body>
</html>

שימוש בניקוד ובאתגרים בהתאמה אישית

כדי להגן מפני השתלטות על חשבונות, כדאי להשתמש במפתחות מבוססי-ניקוד של reCAPTCHA ובאתגרים של אימות רב-שלבי (MFA), כמו אתגרים באימייל וב-SMS שבהם נשלחים למשתמשים קודים חד-פעמיים (OTP).

כדי להשתמש במפתחות מבוססי-ניקוד ובאתגרים מותאמים אישית, אפשר להשתמש באפשרויות הבאות:

בהתאם לתרחיש השימוש, אתם יכולים להשתמש באימות רב-שלבי (MFA) לבד או עם מפתחות מבוססי-ניקוד. לדוגמה, כדי לצמצם את החיכוך, אפשר להשתמש באתגרי MFA רק עבור ציונים מתחת לסף מסוים.

בדוגמה הבאה מוצג אופן השילוב של מפתחות מבוססי-ניקוד בתרחיש של התחברות.

function submitForm() {
  grecaptcha.enterprise.ready(function() {
    grecaptcha.enterprise.execute(
      'reCAPTCHA_site_key', {action: 'account_login'}).then(function(token) {
       document.getElementById("token").value = token;
       document.getElementByID("loginForm").submit();
    });
  });
}
<form id="loginForm" action="?" method="POST">
  Username: <input type="text" name="username"/><br/>
  Password: <input type="password" name="password"/><br/>
  <input type="hidden" id="token" name="recaptcha_token"/>
  <button onclick="submitForm()">Login</button>
</form>
<script src="/https://www.google.com/recaptcha/enterprise.js" async defer></script>

אפשר להתנסות עם הקוד הזה ב-JSFiddle בלחיצה על הסמל <> בפינה השמאלית העליונה של חלון הקוד.

<html>
  <head>
    <title>Account Login - Score</title>
    <script src="/https://www.google.com/recaptcha/enterprise.js" async defer></script>
    <script>
    function submitForm() {
      grecaptcha.enterprise.ready(function() {
        grecaptcha.enterprise.execute(
          'reCAPTCHA_site_key', {action: 'account_login'}).then(function(token) {
           document.getElementById("token").value = token;
           document.getElementByID("loginForm").submit();
        });
      });
    }
    </script>
  </head>
  <body>
    <form id="loginForm" action="?" method="POST">
      Username: <input type="text" name="username"/><br/>
      Password: <input type="password" name="password"/><br/>
      <input type="hidden" id="token" name="recaptcha_token"/>
      <button onclick="submitForm()">Login</button>
    </form>
  </body>
</html>

המאמרים הבאים