Mengupas Tuntas Proses Pentest: Dari Reconnaissance Sampai Nemu Celah IDOR
During a black-box test of an insurance policy inquiry API, the tester obtained a valid token and then changed the policy number in the request while reusing the same token. The server returned another customer's personal and financial data with HTTP 200, indicating an IDOR, though the client later said this was by design for a single internal role.
Published on medium.com
Sebagai orang yang terjun di dunia keamanan siber, momen presentasi hasil pengujian keamanan (penetration testing atau pentest) ke klien itu selalu jadi momen yang deg-degan tapi seru. Baru-baru ini, tim tempat ku magang selesai ngelakuin pengujian buat dua sistem internal milik sebuah perusahaan asuransi: platform…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
During an internship, the team I was part of finished a penetration test for two internal systems belonging to an insurance company: a Learning Management System (LMS) platform and an API Inquiry Polis (policy inquiry API). The LMS is the internal learning platform; the API Inquiry Polis is the integration interface used to pull policyholder data.
The API follows a standard flow. The calling system sends a client key to request a token, the server returns a token valid for a dozen or so minutes, and the system then sends a second request containing the policy number and that token to retrieve customer data. The question that mattered for the test was whether the server only checks that the token is valid, or whether it also checks that the owner of the token is entitled to see the data for the policy number being requested.
Setup
Two testing methods were agreed in the rules of engagement and used together: Black Box and Grey Box.
- Black Box was used first, with no access, no account and no source code, to map the attack surface from the outside without logging in.
- Grey Box followed, with official accounts provided by the client, both as an administrator and as a regular user, to simulate an attacker who has already got in or an employee probing the limits of their access inside the application (dashboard, user management, reporting features).
- The API Inquiry Polis was tested purely Black Box.
Tools used across the engagement:
- CLI utilities for DNS checks, server identification and reading HTTP headers during reconnaissance.
- Crawling and directory brute-force tooling for enumeration.
- A proxy interceptor to dissect traffic and manipulate requests.
- An API client for manual requests against the policy API.
- Automated scanning with thousands of exploit templates.
Finding it
Reconnaissance and enumeration produced the first issues. DNS checks, server identification and HTTP header reading showed the systems running on a web server with a popular PHP-based framework. Crawling and directory brute-forcing then found two sensitive files, a server configuration file and an operating system index file, both publicly reachable with HTTP status 200 OK. Files like these should be blocked from external access; their exposure points to weak deployment hygiene.
After logging in with the official accounts in the Grey Box phase, the proxy interceptor was used to inspect the traffic in and out, looking at the specific parameters sent through the URL. Automated scanning with thousands of exploit templates ran at the same time, but the systems were reasonably well secured and used HTTPS throughout, so the scanner only surfaced small issues such as missing standard security headers and cookie problems. Automated scanners often produce false positives, so everything was validated manually.
The interesting result came from the second system, the policy data API. The critical question was authorisation at the object level: does the server verify that the token holder is entitled to the policy number being requested, or does it stop at validating the token itself?
Exploitation
Step 1: obtain a legitimate token
A token was requested through the legitimate flow, using the client key as the integration is designed to do. The server issued a token valid for a dozen or so minutes.
Step 2: baseline request with the client-supplied policy number
The token was used to call the data endpoint with the policy number the client had provided as a baseline. The data came back with status 200 OK, confirming the normal path works.
Step 3: change the policy number, keep the same token
A small change was made to the digits of the policy number parameter while reusing the same access token. If the system were secure, the server should have rejected the request, because the new policy number does not belong to the account being used.
Instead, the server answered with status 200 OK and returned a link to the data of the new policy. Opening that link in the browser displayed, in clear text, the personal data (such as name and date of birth) and financial data (policy status, premium) of another policyholder.
This is an Insecure Direct Object Reference (IDOR), also called Broken Object Level Authorization.
Root cause
The server validated the token but did not check, per request, whether the token holder was authorised for the specific policy number being requested. Object-level authorisation was missing from the data retrieval path, so any valid token could be paired with any policy number. The server validated the token but did not check whether the token holder was authorised for the specific policy number.
Impact
The exposure covers personal data (name, date of birth) and financial data (policy status, premium) of other policyholders. If policy numbers are sequential, an attacker could write a script to harvest thousands of customer records in a short time. This is a red flag for compliance with Indonesia's Personal Data Protection Law (UU PDP).
There is an important limit on the finding. When the IDOR was presented to the client, the client rejected it, explaining that in the current application architecture the API is designed for a single internal role only, so access to any policy number is considered normal, that is, by design. The finding was therefore formally rejected on business grounds. In security theory, however, the pattern found is a textbook example of how IDOR can be exploited.
Fix
The report does not describe any remediation applied by the client. The lesson drawn from the test is that securing an API is not only about issuing a password or a token, but also about making sure who is entitled to see the data at the other end. The lesson drawn is that securing an API is not only about issuing a password or a token, but also about making sure who is entitled to see the data at the other end.
Variants to test
- Sequential or guessable object identifiers on other APIs. Take a valid token, request your own object, then change the identifier by one digit. A positive result is a 200 OK with another party's data instead of a 403 or 404.
- Token-only validation on integration endpoints. Request a token through the legitimate client-key flow and call the data endpoint with an object identifier that was never issued to that client. A positive result is data returned for an object outside the client's scope.
- Exposed deployment files. Run crawling and directory brute-forcing against the target and look for server configuration files and operating system index files. A positive result is HTTP 200 OK on a file that should never be publicly reachable.
- Missing security headers and cookie issues. Confirm scanner output manually; a positive result is a reproducible header or cookie weakness on a response you control the request for.
- Role boundaries in Grey Box. With an administrator and a regular user account, replay requests from one role against objects belonging to the other. A positive result is a regular user retrieving administrative or other users' records.
What happened, in plain words
A small team of security testers, working as part of an internship, was hired to check two internal systems belonging to an insurance company. The first was a Learning Management System (LMS), which is the company's internal training platform where staff take courses and track their progress. The second was an API Inquiry Polis, which is a piece of software that lets one computer system ask another for policyholder data. "Polis" is Indonesian for insurance policy, so this API is the door through which other systems pull customer policy information.
The testers agreed the rules of engagement with the client before starting. That written permission is called the rules of engagement, and it matters because it sets out what you may and may not do. During the test they found a serious weakness in the policy API: by changing one number in a request, they could see another customer's personal and financial data. They reported it. The client rejected the finding, saying the API is only ever used by one internal role, so reaching any policy number is normal by design. The testers accepted that decision formally, but the pattern they found is still a textbook example of a well-known class of bug.
This article walks through the whole engagement in the order it happened: how the testers set up, how they looked at the systems from outside, what they found inside, and how the policy API weakness was demonstrated.
Two ways of testing: Black Box and Grey Box
Before touching anything, the team agreed on the rules of engagement. Two testing methods were used together.
- Black Box means testing with no access at all: no account, no source code, nothing. Think of a burglar who has never seen the house and has no key. The point is to see what an outsider can reach without logging in, and to map the attack surface, which is simply the list of everything the outside world can see and touch.
- Grey Box means testing with some access. Here the client handed over official accounts, one as an administrator and one as a regular user. This simulates two realistic situations: an attacker who has already got in somehow, and an employee poking at the limits of what their account allows inside the application, in areas such as the dashboard, user management and reporting features.
The policy API was tested purely Black Box, with no accounts at all.
Why do it in this order? Because the outside view tells you what is exposed to the whole internet, and the inside view tells you whether the walls between users hold up once someone is already through the front door. They answer different questions.
The tools, and what each one is for
Across the engagement the team used a handful of tools. None of them are magic; each does one job.
- Command-line utilities for DNS checks, server identification and reading HTTP headers. DNS is the system that turns a name like example.com into the address of a machine. HTTP headers are small labels that travel with every web request and response, and they often reveal what software the server runs. Reading them is like reading the label on a parcel before opening it.
- Crawling and directory brute-force tooling for enumeration. A crawler follows every link it can find, like a person clicking around a website. Brute-forcing directories means trying a long list of common folder and file names to see which ones exist. Enumeration is just the formal word for making a list of what is there.
- A proxy interceptor, which sits between your browser or tool and the server and lets you read and edit every request and response as it passes. Think of a postal worker who opens each letter, reads it, and can rewrite it before delivering it.
- An API client for sending manual requests to the policy API. An API is a way for two computer programs to talk to each other without a human clicking anything; an API client is the tool you use to speak that language by hand.
- Automated scanning with thousands of exploit templates. A scanner fires a large library of known test cases at a target and reports what looks interesting. It is fast but noisy.
Step one: looking from the outside (reconnaissance and enumeration)
Reconnaissance means gathering information before attacking anything. It is the equivalent of walking around a building, noting the doors, the cameras and the signs, before trying a handle.
The DNS checks, server identification and HTTP header reading showed that the systems ran on a web server with a popular PHP-based framework. PHP is a programming language commonly used to build websites; a framework is a ready-made set of building blocks that developers use on top of it. Knowing this narrows down what to look for later.
Crawling and directory brute-forcing then turned up two sensitive files: a server configuration file and an operating system index file. Both were publicly reachable, answering with HTTP status 200 OK. Status 200 is the web's way of saying "here you go, everything is fine". Files like these should be blocked from outside access. Their exposure points to weak deployment hygiene, which means the care taken when putting software onto a live server was not good enough.
Why does this matter? A configuration file can describe how the server is set up, and an index file can list what is in a directory. Neither should be readable by a stranger on the internet.
Step two: looking from the inside (Grey Box)
Once logged in with the official accounts, the team switched on the proxy interceptor to inspect the traffic going in and out. The focus was on the specific parameters sent through the URL. A parameter is a named value attached to a request, the part after the question mark in a web address, and it is often where an application tells the server which record it wants.
At the same time, automated scanning ran with thousands of exploit templates. The systems were reasonably well secured and used HTTPS throughout. HTTPS is the encrypted version of the web: the conversation between your browser and the server is scrambled so nobody in the middle can read it. Because of that, the scanner only surfaced small issues, such as missing standard security headers and cookie problems.
A cookie is a small piece of data a website stores in your browser so it can recognise you on the next request, a bit like a cloakroom ticket. If a cookie is set up badly, someone else may be able to use your ticket. Security headers are instructions the server sends to the browser telling it to behave more safely.
One important habit here: automated scanners often produce false positives, meaning they report a problem that is not really there. So every scanner result was checked by hand before being believed.
The interesting part: the policy data API
The second system, the policy data API, is where the real finding came from. The API follows a standard flow, and it helps to picture it as a conversation at a bank counter.
- The calling system sends a client key to request a token. A client key is a secret string that identifies the calling system, like a membership card.
- The server returns a token valid for a dozen or so minutes. A token is a temporary pass proving you were allowed in a moment ago; it expires so that a stolen one is not useful forever.
- The system then sends a second request containing the policy number and that token to retrieve customer data. The policy number is the identifier of the record being asked for.
The question that mattered for the test was simple to state: does the server only check that the token is valid, or does it also check that the owner of the token is entitled to see the data for the policy number being requested? In bank terms: does the clerk check that the card is genuine, or also that the card belongs to the person asking about this particular account?
Demonstrating the weakness
Step 1: get a legitimate token
A token was requested through the legitimate flow, using the client key exactly as the integration is designed to do. The server issued a token valid for a dozen or so minutes. Nothing shady here: this is the normal, intended way to start.
Step 2: a baseline request with the client-supplied policy number
The token was used to call the data endpoint with the policy number the client had provided, as a baseline. A baseline is a known-good result you establish first, so that later you can tell what changed. The data came back with status 200 OK, confirming the normal path works.
Step 3: change the policy number, keep the same token
A small change was made to the digits of the policy number parameter, while reusing the same access token. If the system were secure, the server should have rejected the request, because the new policy number does not belong to the account being used.
Instead, the server answered with status 200 OK and returned a link to the data of the new policy. Opening that link in the browser displayed, in clear text, the personal data (such as name and date of birth) and financial data (policy status, premium) of another policyholder. Premium here means the amount the customer pays for the insurance.
This is an Insecure Direct Object Reference (IDOR), also called Broken Object Level Authorization. In plain words: the application lets you name an object directly, here a policy number, and never checks whether that object is yours. It is like a hotel where the receptionist checks that your key card is real, but never checks that room 214 is the room you booked, so any valid card opens any door.
Why it worked
The server validated the token but did not check, per request, whether the token holder was authorised for the specific policy number being requested. Object-level authorisation was missing from the data retrieval path, so any valid token could be paired with any policy number.
The server validated the token but did not check whether the token holder was authorised for the specific policy number. The caller really did have a valid token, and the request was built correctly. The only thing missing was the ownership check: the step that asks "is this record yours to see?"
What the impact would be
The exposure covers personal data (name, date of birth) and financial data (policy status, premium) of other policyholders. If policy numbers are sequential, meaning they run in order like 1001, 1002, 1003, an attacker could write a script to harvest thousands of customer records in a short time. You would not need to guess anything; you would just count upwards.
This is a red flag for compliance with Indonesia's Personal Data Protection Law (UU PDP), the country's data protection rules. A company holding this kind of data has legal duties about who can see it.
There is an important limit on the finding. When the IDOR was presented to the client, the client rejected it, explaining that in the current application architecture the API is designed for a single internal role only, so access to any policy number is considered normal, that is, by design. The finding was therefore formally rejected on business grounds. In security theory, however, the pattern found is a textbook example of how IDOR can be exploited.
What to do about it
The report does not describe any remediation applied by the client. The lesson drawn from the test is that securing an API is not only about issuing a password or a token, but also about making sure who is entitled to see the data at the other end. The lesson drawn is that securing an API is not only about issuing a password or a token, but also about making sure who is entitled to see the data at the other end.
Other places to look for the same pattern
These are the variants worth testing on other systems, in the same spirit as the main finding.
- Sequential or guessable object identifiers on other APIs. Take a valid token, request your own object, then change the identifier by one digit. A positive result is a 200 OK with another party's data instead of a 403 or 404. Status 403 means "forbidden" and 404 means "not found"; either would show the server refused to hand over someone else's record.
- Token-only validation on integration endpoints. Request a token through the legitimate client-key flow and call the data endpoint with an object identifier that was never issued to that client. A positive result is data returned for an object outside the client's scope.
- Exposed deployment files. Run crawling and directory brute-forcing against the target and look for server configuration files and operating system index files. A positive result is HTTP 200 OK on a file that should never be publicly reachable.
- Missing security headers and cookie issues. Confirm scanner output manually; a positive result is a reproducible header or cookie weakness on a response you control the request for.
- Role boundaries in Grey Box. With an administrator and a regular user account, replay requests from one role against objects belonging to the other. A positive result is a regular user retrieving administrative or other users' records.
Glossary
- API: a way for two computer programs to talk to each other, so one can ask the other for data or actions without a human clicking anything.
- API client: a tool used to send requests to an API by hand, so you can see exactly what goes out and what comes back.
- Attack surface: everything on a system that an outsider can see or reach, and therefore might try to use.
- Authentication: proving who you are, for example by logging in or presenting a valid token.
- Authorisation: deciding what you are allowed to do once you are known, for example which records you may read.
- Baseline: a known-good result recorded first, so later changes can be compared against it.
- Black Box testing: testing with no access, no account and no source code, as an outsider would.
- Brute-forcing directories: trying a long list of common folder and file names to discover which ones exist on a server.
- Client key: a secret string that identifies the calling system, used to request a token.
- Cookie: a small piece of data a website stores in your browser so it can recognise you on later requests.
- Crawler: a tool that follows links automatically to discover pages on a site.
- DNS: the system that turns a name like example.com into the address of a machine.
- Enumeration: making a list of what exists on a target, such as pages, folders or files.
- False positive: a problem reported by a tool that turns out not to be real when checked by hand.
- Framework: a ready-made set of building blocks developers use on top of a programming language.
- Grey Box testing: testing with some access, such as official accounts, to simulate someone already inside.
- HTTP headers: small labels sent with every web request and response, often revealing software details or security settings.
- HTTPS: the encrypted version of the web, so the conversation between browser and server cannot be read in transit.
- IDOR (Insecure Direct Object Reference): a bug where an application lets you name a record directly and never checks that the record is yours.
- Broken Object Level Authorization: another name for IDOR, describing the missing per-record permission check.
- LMS (Learning Management System): an internal platform where staff take courses and track their progress.
- Object: a single record in a system, such as one policy, one user or one order.
- Parameter: a named value attached to a request, often telling the server which record is wanted.
- PHP: a programming language commonly used to build websites.
- Policy number: the identifier of a single insurance policy record.
- Premium: the amount a customer pays for an insurance policy.
- Proxy interceptor: a tool that sits between your browser or client and the server, letting you read and edit every request and response.
- Reconnaissance: gathering information about a target before attacking it.
- Rules of engagement: the written agreement setting out what a tester may and may not do.
- Scanner: a tool that fires a large library of known test cases at a target and reports what looks interesting.
- Security headers: instructions a server sends to the browser telling it to behave more safely.
- Sequential identifiers: record numbers that run in order, making them easy to guess by counting.
- Status 200 OK: the web's way of saying the request succeeded and here is the content.
- Status 403: the web's way of saying you are not allowed to see this.
- Status 404: the web's way of saying this does not exist.
- Token: a temporary pass proving you were allowed in a moment ago, which expires after a short time.
- UU PDP: Indonesia's Personal Data Protection Law, which sets rules on who may see personal data.