> For the complete documentation index, see [llms.txt](https://heinosass.gitbook.io/leet-sheet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://heinosass.gitbook.io/leet-sheet/web-app-hacking/server-attacks/collisions.md).

# Collisions

## Unicode Case Mapping Collisions

A collision occurs when two *different* Unicode characters are uppercased or lowercased into the same character.

```
'ß'.toUpperCase() === 'ss'.toUpperCase() // true
'ß'.toUpperCase() === 'SS' // true
```

*Note: `'ß'.toLowerCase()`* ***does not** equal `ss`.*

Click here for a [complete list of Unicode collisions](https://eng.getwisdom.io/awesome-unicode/#onetomanycasemappings).

You may sometimes be able to abuse this with "Forgot password" emails, for example. If it asks you for an email address, then instead of "<sass@sass.com>" you can put in "saß@sass.com" or "sass\@saß.com". If the application converts it to lowercase and compares your input to "<sass@sass.com>", then the password reset link will be sent to your malicious email instead of "<sass@sass.com>".

Here's a vulnerable Node.js application's code, for example:

```
malicious_email = 'saß@sass.com';

// Converted to 'SASS@SASS.COM'
uppercased_email = malicious_email.toUpperCase();

// Will match a an existing user that's not controlled by the attacker ('SASS@SASS.COM')
user_id = get_user_from_database(uppercased_email);

if (user_id) {
  // Sends an email to 'saß@sass.com' for a password reset for the 'sass@sass.com' user.
  send_recovery_email(user_id, malicious_email);
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://heinosass.gitbook.io/leet-sheet/web-app-hacking/server-attacks/collisions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
