Vai à Black Hat? Vamos nos encontrar

Técnico

Credential Stuffing — O que é um ataque de Credential Stuffing e como se proteger dele

July 12, 2021

Michael Isbitski
Evangelista Técnico

O credential stuffing é um tipo de ataque no qual hackers utilizam automação e listas de nomes de usuário e senhas comprometidos para burlar mecanismos de autenticação e autorização, com o objetivo final de realizar a tomada de conta (ATO) e/ou exfiltração de dados. Como os mecanismos de autenticação e autorização são quase sempre operados por APIs, o credential stuffing e o ATO ocupam o topo da lista de preocupações das organizações e de suas estratégias de segurança de API. A técnica de ataque de credential stuffing explora a tendência dos usuários de reutilizar suas credenciais em vários serviços e aplicativos. Embora o credential stuffing possa apresentar baixas taxas de sucesso para os atacantes, o uso de automação permite que eles gerem grandes volumes de tentativas de login originadas de diferentes endereços IP, diminuindo a probabilidade de que os controles de segurança tradicionais identifiquem o ataque como uma atividade maliciosa. Os atacantes também controlam a velocidade de seus ataques de credential stuffing para evitar a detecção e, consequentemente, não acionar os limites de taxa que uma organização possa ter definido nos endpoints de API. Serviços com um fluxo de tráfego normalmente massivo podem não reconhecer um ataque de credential stuffing, pois não conseguem distinguir as atividades de um único atacante em meio ao grande volume de tráfego.

Credential Stuffing versus Ataque de Força Bruta – Qual é a diferença?

Os ataques de credential stuffing são semelhantes aos ataques de força bruta, pois o atacante tenta obter credenciais de usuário válidas para realizar uma ATO e obter acesso a dados ou funcionalidades confidenciais. A diferença é que os ataques de força bruta consistem no atacante enumerar sequências alfanuméricas para encontrar combinações de nome de usuário e senha que forneçam um contexto autenticado. Ataques de força bruta frequentemente combinam cada nome de usuário em um ataque de um (nome de usuário) para muitos (senhas). Os atacantes também podem tentar realizar força bruta em nomes de usuário, dependendo da quantidade de informações que possuem no início de sua campanha de ataque. Ataques de força bruta são mais bem-sucedidos quando os usuários escolhem senhas simples ou fáceis de adivinhar.

O credential stuffing, por outro lado, baseia-se em listas de combinações de nome de usuário/senha comprometidas e no hábito comum dos usuários de utilizar as mesmas credenciais em vários serviços. O sucesso dos ataques de credential stuffing aumenta quando o nome de usuário é um endereço de e-mail, já que essa informação é facilmente obtida ou adivinhada pelos atacantes. Tanto o credential stuffing quanto os ataques de força bruta podem ser mitigados pela implementação de políticas que bloqueiam uma conta após várias tentativas de login. No entanto, definir uma política de bloqueio de conta muito rigorosa prejudicará a experiência do usuário. As organizações, buscando equilibrar essas demandas, às vezes implementam uma política mais flexível, como bloquear a conta apenas após 10 tentativas incorretas em uma hora. Os atacantes podem tirar proveito dessas configurações relaxadas – neste caso, os atacantes poderiam configurar suas ferramentas para realizar nove tentativas, parar e não retomar a campanha de ataque até que 60 minutos tenham se passado.

Os ataques de Credential Stuffing estão em ascensão

Os ataques de credential stuffing não são apenas uma forma mais eficiente e eficaz para os atacantes obterem acesso não autorizado do que os ataques tradicionais de força bruta, eles também estão se tornando mais fáceis de perpetrar. Há alguns anos, se um hacker obtivesse acesso a um tesouro de informações de credenciais, ele frequentemente as guardava para si ou as oferecia para venda na dark web. Mas, em 2019, a chamada lista Collections #1–5 apareceu em fóruns de hackers e torrents, sendo distribuída livremente. Essas coleções incluem impressionantes 3,2 bilhões de nomes de usuário únicos e senhas associadas. Ferramentas de script e automação também se tornaram mais abundantes. As organizações dependem da automação para muitos casos de negócios legítimos, mas os atacantes frequentemente usam grande parte dessas mesmas ferramentas de automação para realizar ataques de credential stuffing.

Como funcionam os ataques de Credential Stuffing?

A seguir, o processo típico que um atacante utiliza ao realizar um ataque de credential stuffing:

  1. Realizar o reconhecimento de um alvo e suas APIs — os atacantes escaneiam e coletam informações sobre seus alvos de forma furtiva, frequentemente selecionando suas vítimas com base em dados ou funcionalidades de alto valor ou reconhecimento de marca. A coleta de informações inclui faixas de endereços IP, nomes de domínio registrados, servidores de aplicação de hospedagem e endpoints de API expostos. Os atacantes também fazem engenharia reversa do código do cliente de aplicações web e móveis para entender melhor como interagir com as APIs de back-end.
  2. Compilar um conjunto de dados de credenciais roubadas — um atacante reúne grandes conjuntos de credenciais que já foram funcionais e, tipicamente, obtidas de violações de dados anteriores, campanhas de credential stuffing e sucessos de ATO. Essas credenciais tornam-se as entradas para ferramentas de automação e servem como material de autenticação para um endpoint de API alvo.
  3. Configurar a ferramenta de automação com limitação de taxa — um atacante configura a ferramenta de automação de sua escolha ou cria scripts. A configuração depende de vários fatores, incluindo a singularidade dos endpoints da API alvo, o nível de integração que o atacante precisa para outras ferramentas de ataque ou simplesmente a preferência do próprio atacante. Os atacantes configuram adicionalmente a ferramenta de automação para evitar a detecção e os limites de bloqueio. As etapas incluem imitar metadados de user agent legítimos, evitar o uso de multi-threading e tentar logins uma vez por minuto. Observe que as ferramentas de automação — quando configuradas corretamente — parecem e se comportam de forma muito semelhante à atividade comercial típica e autorizada.
  4. Lançar o ataque contra a API de login — uma vez que os atacantes configuraram suas ferramentas de automação com todos os pré-requisitos apropriados, eles lançam seus ataques contra o mecanismo de login. Pode levar algum tempo para descobrir uma credencial funcional para o login, dependendo da idade e validade do conjunto de dados de credenciais roubadas que o atacante está usando. Os atacantes provavelmente lançarão múltiplas instâncias da ferramenta de automação a partir de diferentes localizações de rede (como em um provedor de nuvem) e, frequentemente, distribuídas geograficamente para acelerar o processo e evitar ainda mais a detecção.
  5. Rastrear sucessos e falhas de credenciais de login — um atacante deve rastrear os sucessos e falhas em todas as instâncias da ferramenta de automação de ataque. Essa correlação pode ser tão básica quanto verificar logs em busca de códigos de sucesso após o fato, mas a maioria dos atacantes configurará ou codificará esses resultados em suas ferramentas de automação para não perder tempo tentando novos logins. Uma vez que o atacante obtém um login funcional, esse resultado é tecnicamente o ponto de ATO. Um atacante provavelmente mudará o foco na campanha de ataque, obterá uma sessão autenticada via API de login e, então, continuará a exfiltrar dados, elevar privilégios ou abusar ainda mais da funcionalidade.

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.

Nossas últimas publicações