¿Vas a ir a Black Hat? Reunámonos

Técnico

Credential stuffing: ¿Qué es un ataque de credential stuffing y cómo defenderse de él?

July 12, 2021

Michael Isbitski
Evangelista técnico

El relleno de credenciales es un tipo de ataque en el que los piratas informáticos utilizan la automatización y listas de nombres de usuario y contraseñas comprometidos para vulnerar los mecanismos de autenticación y autorización, con el objetivo final de apropiarse de cuentas (ATO) o exfiltrar datos. Los mecanismos de autenticación y autorización suelen estar gestionados por API, lo que sitúa al relleno de credenciales y a la apropiación de cuentas en los primeros puestos de las preocupaciones de las organizaciones y de su estrategia de seguridad de API. Esta técnica de ataque aprovecha la tendencia de los usuarios a reutilizar sus credenciales en múltiples servicios y aplicaciones. Aunque el relleno de credenciales puede ofrecer tasas de éxito bajas para los atacantes, el uso de la automatización les permite generar grandes volúmenes de intentos de inicio de sesión desde diferentes direcciones IP, lo que reduce la probabilidad de que los controles de seguridad tradicionales detecten el ataque como una actividad maliciosa. Los atacantes también limitan la velocidad de sus ataques para evitar ser detectados y, por tanto, no activar los límites de tasa que una organización pueda haber establecido en los puntos finales de la API. Los servicios con un flujo de tráfico masivo pueden no detectar el ataque en absoluto, ya que no pueden distinguir las actividades de un atacante individual dentro de la masa de tráfico.

Relleno de credenciales frente a ataque de fuerza bruta: ¿cuál es la diferencia?

Los ataques de relleno de credenciales son similares a los de fuerza bruta en el sentido de que el atacante intenta obtener credenciales de usuario válidas para lograr la apropiación de la cuenta y obtener acceso a datos o funciones confidenciales. La diferencia radica en que los ataques de fuerza bruta consisten en que el atacante enumera secuencias alfanuméricas para encontrar combinaciones de nombre de usuario y contraseña que proporcionen un contexto autenticado. Los ataques de fuerza bruta suelen combinar cada nombre de usuario en un ataque de uno (nombre de usuario) a muchos (contraseña). Los atacantes también pueden intentar forzar los nombres de usuario, dependiendo de la información que tengan al inicio de su campaña. Los ataques de fuerza bruta tienen más éxito cuando los usuarios eligen contraseñas sencillas o fáciles de adivinar.

El relleno de credenciales, por otro lado, se basa en listas de combinaciones de nombre de usuario y contraseña comprometidas, y en el mal hábito común de los usuarios de utilizar las mismas credenciales en múltiples servicios. El éxito de estos ataques aumenta cuando el nombre de usuario es una dirección de correo electrónico, ya que esta información es fácil de obtener o adivinar para los atacantes. Tanto el relleno de credenciales como los ataques de fuerza bruta pueden mitigarse implementando políticas que bloqueen una cuenta tras varios intentos de inicio de sesión. Sin embargo, establecer una política de bloqueo de cuentas demasiado estricta puede perjudicar la experiencia del usuario. Las organizaciones que buscan equilibrar estas demandas a veces implementan una política más laxa, como bloquear la cuenta solo después de 10 intentos fallidos en una hora. Los atacantes pueden aprovechar estos ajustes relajados; en este caso, podrían configurar sus herramientas para realizar nueve intentos, detenerse y no reanudar la campaña hasta que hayan pasado 60 minutos.

Los ataques de relleno de credenciales van en aumento

Los ataques de relleno de credenciales no solo son una forma más eficiente y eficaz para que los atacantes obtengan acceso no autorizado que los ataques tradicionales de fuerza bruta, sino que también son cada vez más fáciles de perpetrar. Hace unos años, si un pirata informático obtenía acceso a un conjunto de credenciales, solía guardárselo para sí mismo u ofrecerlo a la venta en la web oscura. Pero en 2019, la llamada lista Collections #1–5 apareció en foros de hackers y torrents, distribuyéndose libremente. Estas colecciones incluyen la asombrosa cifra de 3200 millones de nombres de usuario y contraseñas asociados únicos. Las herramientas de automatización y creación de scripts también son más abundantes. Las organizaciones dependen de la automatización para muchos casos de negocio legítimos, pero los atacantes suelen utilizar gran parte de esas mismas herramientas para llevar a cabo ataques de relleno de credenciales.

¿Cómo funcionan los ataques de relleno de credenciales?

El siguiente es un proceso típico que utiliza un atacante al realizar un ataque de relleno de credenciales:

  1. Realizar el reconocimiento del objetivo y sus API — los atacantes escanean y recopilan información sobre sus objetivos de forma sigilosa, seleccionando a menudo a sus víctimas en función de datos o funcionalidades de gran valor o reconocimiento de marca. La recopilación de información incluye rangos de direcciones IP, nombres de dominio registrados, servidores de aplicaciones de alojamiento y puntos finales de API expuestos. Los atacantes también realizan ingeniería inversa en el código del cliente de las aplicaciones web y móviles para comprender mejor cómo interactuar con las API de back-end.
  2. Compilar un conjunto de datos de credenciales robadas — un atacante reúne grandes conjuntos de credenciales que en su día funcionaron y que suelen proceder de filtraciones de datos anteriores, campañas de relleno de credenciales y ataques de apropiación de cuentas (ATO) exitosos. Estas credenciales se convierten en los datos de entrada de las herramientas de automatización y sirven como material de autenticación para un punto final de API objetivo.
  3. Configurar la herramienta de automatización con limitación de velocidad — un atacante configura la herramienta de automatización que prefiera o crea scripts. La configuración depende de varios factores, como la singularidad de los puntos finales de la API objetivo, el nivel de integración que el atacante necesite para otras herramientas de ataque o, simplemente, la preferencia del propio atacante. Además, los atacantes configuran las herramientas de automatización para evadir la detección y los umbrales de bloqueo. Los pasos incluyen imitar los metadatos del agente de usuario legítimo, evitar el uso de subprocesos múltiples e intentar iniciar sesión una vez por minuto. Tenga en cuenta que las herramientas de automatización, cuando se configuran correctamente, tienen un aspecto y un comportamiento muy similares a los de la actividad empresarial típica y autorizada.
  4. Lanzar el ataque contra la API de inicio de sesión — una vez que los atacantes han configurado sus herramientas de automatización con todos los requisitos previos adecuados, lanzan sus ataques contra el mecanismo de inicio de sesión. Puede llevar algún tiempo descubrir una credencial válida para el inicio de sesión, dependiendo de la antigüedad y la validez del conjunto de datos de credenciales robadas que esté utilizando el atacante. Es probable que los atacantes lancen múltiples instancias de la herramienta de automatización desde diferentes ubicaciones de red (como en un proveedor de nube) y, a menudo, distribuidas geográficamente para acelerar el proceso y evadir aún más la detección.
  5. Realizar un seguimiento de los éxitos y fracasos de las credenciales de inicio de sesión — un atacante debe realizar un seguimiento de los éxitos y fracasos en todas las instancias de las herramientas de automatización de ataques. Esta correlación puede ser tan básica como comprobar los registros en busca de códigos de éxito a posteriori, pero la mayoría de los atacantes configurarán o programarán estos resultados en sus herramientas de automatización para no perder tiempo intentando más inicios de sesión. Una vez que el atacante ha obtenido un inicio de sesión válido, este resultado es técnicamente el punto de la apropiación de cuenta (ATO). Es probable que el atacante cambie entonces el rumbo de la campaña de ataque, obtenga una sesión autenticada a través de la API de inicio de sesión y, a continuación, continúe exfiltrando datos, escalando privilegios o abusando aún más de la funcionalidad.

How to Defend Against Credential Stuffing

Credential stuffing can be thwarted when the right practices and tools are in place:

Implement Behavioral Analytics

Credential stuffing can be more easily and quickly detected if an organization is able to establish baselines of typical user behavior and traffic patterns. API security offerings like the Salt Security API Protection Platform can automatically create and maintain baselines of typical behavior and identify any activity that deviates from the baseline, including the abnormal movement of data and the attempted manipulation of tokens, user IDs, or API parameters.

Avoid Using Email Addresses as User IDs

Credential stuffing relies on users leveraging the same usernames or account IDs across services. The risk runs higher when the ID is an email address since it is easily obtained or guessed by attackers. Requiring unique usernames can mitigate some of the risk of credential stuffing attacks and potentially exposing users to ATO.

Use Multi-Factor Authentication (MFA)

Credential stuffing relies on automation scripts and tools that cannot easily provide additional factors of authentication, particularly mobile phone authenticator tokens or 2FA tokens sent through alternate channels such as email or SMS. Requiring users to authenticate with additional authentication factors helps mitigate against credential stuffing attacks. Note that attackers can and will also target MFA mechanisms, and organizations must also protect any MFA mechanisms from brute force attacks.

Additional industry guidance suggests the following less-effective defenses against credential stuffing. We mention them here to give the reader a full picture of protection options and to point out potential downsides of these practices.

Use CAPTCHA

CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) can reduce the effectiveness of credential stuffing attacks by challenging users to prove that they are human with tasks that are easy for humans but more difficult for computers, such as identifying specific objects in a set of images or recognizing distorted letters. CAPTCHA is easily added to an app or site, but it is just as easily bypassed by hackers using headless browsers or CAPTCHA solving services. The negative interruptive user experience is not commensurate with the amount of security CAPTCHA delivers.

Deploy Device Fingerprinting and User Profiling

Device fingerprinting combines certain attributes of a device to identify it as unique, including operating system, type and version of web browser, language settings, and IP address. Additional user profiling techniques will track how individuals use the devices and the applications on that device, such as where they touch the screen or how fast they move a mouse cursor. When using device fingerprinting as a defense against credential stuffing, one assumes that a device recognized as having certain attributes on one day is the same device seen with those same attributes on another day. If the same combination of parameters logs in several times in sequence, it may point to a credential stuffing attack. The downsides of fingerprinting and profiling include that they require client-side code, which can be reverse engineered and bypassed, and these protections simply don’t work in machine-to-machine or direct API communications.

Implement IP Address Deny lists

Attackers may be working from a limited pool of IP addresses, so recognizing and blocking IPs that attempt to log into multiple accounts can provide some defense against credential stuffing. But recognizing a malicious IP address is not that simple. A hidden link analysis report from Recorded Future suggests that 92% of suspicious IPs are not blacklisted, often because rate limits can be difficult to operationalize across infrastructure. These lists are often not well maintained, and attackers will cycle through IP addresses. Cheap and plentiful cloud computing resources also worsens matters. Attackers will spin up new instances of machines or use serverless compute to perpetuate their credential stuffing attacks, raising the difficulty bar substantially for security teams trying to maintain deny lists.

Rate-Limit Non-Residential Traffic Sources

Attackers may originate attacks from other countries where your organization doesn’t typically do business. Countries such as China, North Korea, or Russia can rank high on the list of concerns for security teams since they are sometimes home to malicious threat actors. You may opt to implement more restrictive rate limits for the IP address ranges of those regions to help mitigate some of the risk of credential stuffing, but most attackers will likely shift to other less restricted IP address space by leveraging other data centers and cloud providers. If you are a global business, applying regional rate limits may also impact legitimate users and have negative impact to the business.

Block Headless Browsers

A headless browser is a web browser without a GUI. The label is also sometimes used to describe scripts or automation tools. Headless browsers can be a great tool for test automation and process automation, frequently used by development, QA, and business teams. They are not typically used for legitimate web browsing and may sometimes lack a proper JavaScript engine to execute client-side code. Blocking headless browsers can sometimes be a useful mitigation option depending on an organization’s use of automated IT processes, but don’t rely on it as a defense against credential stuffing. Determined attackers will circumvent such basic controls by using more advanced headless browser technology or tuning scripts to more closely mimic traditional browser behavior.

Stop Credential Stuffing Attacks in their Tracks

Stopping credential stuffing attacks without negatively impacting user experience or deploying client-side code controls that are able to be bypassed means you need to start with the ability to analyze as much data as possible to understand normal behavior, identify the outliers, and put together the pieces to form a bigger picture.

Credential stuffing attacks can “hide in plain sight,” evading existing security measures, especially with services that regularly get massive traffic flows. You need to baseline and analyze traffic to identify anomalies. Beyond that, you also need a solution that can differentiate between user mistakes or behavior that changes in response to a changed API and. malicious activity, such as an attacker probing an API and manipulating API logic.

Salt Security’s API Protection Platform correlates disparate data to analyze behaviors of users and machines as they interact with APIs. After collecting a copy of all an organization’s APIs and pulling it into its big data engine, the Salt platform then uses ML and AI to create a baseline of normal behavior so it can identify anomalies. With this context, Salt accurately distinguishes malicious attacker activity and stops attackers before they’re able to compromise accounts.

Alerts from the Salt Security API Protection Platform contain the crucial context that incident response teams need to understand and respond quickly and effectively to credential stuffing attacks. Our platform provides full timelines of attacker activity, so teams gain insight into what the attacker did and how the application responded. Teams have no need to correlate relevant attack information manually – the platform provides this correlation automatically.

The context that the Salt Security API Protection Platform provides is also essential to helping development teams eliminate vulnerabilities quickly and continuously improve API security posture. A form of feedback loop often promoted as part of DevOps practices, remediation insights within the Salt platform contain details on the location of a vulnerability and what normal activity looks like for that API. The insights also include recommendations on how developers can tackle misconfigurations, close security gaps, and otherwise improve security posture. And Salt delivers these insights in the platforms developer teams are already using, such as Jira and Slack.

Would you like to see how to defend against credential stuffing in your network? Request a personalized demo to see how Salt can help you defend against credential stuffing attacks and how to improve your API security posture.

Nuestras últimas publicaciones