#BugBounty — API keys leakage, Source code disclosure in India’s largest e-commerce health care company.
A path traversal vulnerability allowed reading arbitrary files, including source code and the web.config file, which exposed API keys for mail, SMS, and payment services. The attacker could use these keys to send emails and SMS to customers and potentially manipulate payments.
Published on medium.com
{{media:0}}
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
This is a write-up of a bug bounty finding against what the author describes as India's largest online health platform website. The report does not name the company or the specific feature beyond the vulnerable URL and parameter shown in the screenshots. The weakness is a path traversal that leads to local file inclusion on a Microsoft-IIS web server, which the author escalated from reading a Windows system file to reading application source code and finally the web.config file.
By the author's summary, the vulnerability allowed reading the application's source code and sensitive files such as webconfig, which contained API keys for the mail server, SMS and payment gateway. The author also states that the mail server key could be used to send mail from the company's enterprise mail server and that the SMS keys could be used to send SMS to their customers.
Setup
The report does not describe any accounts, roles, tools or versions. The only precondition visible in the write-up is that the target ran Microsoft-IIS, which the author inferred from the Server response header. The author notes that knowing it was an IIS server made the application directory layout predictable, which mattered for the later steps.
Finding it
The author found the issue in a URL and a parameter, shown in the screenshot below. The report does not reproduce the URL or parameter as text, so the exact request is only visible in the image.

Vulnerable URL
The response to that HTTP request is shown next.

Vulnerable Request response
Looking at that response, the author noticed the Server HTTP header and concluded that a Microsoft-IIS web server was in use. That observation is what shaped the rest of the attack: on IIS, the author knew how the application directory would look, and could aim the traversal at Windows system files and at application files by relative path.
Exploitation
Step 1: Confirm file read with WIN.INI
With IIS identified, the author tried to open the Windows WIN.INI file using path traversal.

Path traversal atatck
The response came back as follows.

HTTP Response
The author identifies this response as the content of the WIN.INI file, which confirmed that a local file inclusion vulnerability existed. The report does not reproduce the payload as text; it is only visible in the screenshot above.
Step 2: Read application source code
With file read confirmed, the author escalated and tried to read source code of the application. Because the server was IIS, the author says the application directory layout was clear, and the first target was the source code of the login page.

Login page source code request
The response came back as expected.

Login page source code
The author states that, in the same way, the complete source code of any page of the application could be downloaded.
Step 3: Read web.config and extract secrets
The critical step was reading the web.config file.

Web Config file inclusion
When the author saw the response to that request, they say they had a huge smile on their face.


According to the author, all the sensitive API keys were exposed: the mail server API key, IIS server admin credentials, SMS API keys and payment gateway keys. The author describes this as really critical and states that these keys could be used to send mails, send SMS to users, perform payment manipulation and several more actions.
Root cause
The author's reasoning implies that the IIS directory layout made it easy to target both Windows system files and application files such as the login page source and web.config.
The exposure of web.config is the key amplifier: on IIS, that file commonly holds connection strings and application secrets, and here it held mail, SMS, payment gateway and IIS admin credentials.
Impact
Under the conditions shown, an attacker who can reach the vulnerable URL and parameter could read files such as WIN.INI, the source code of pages and the web.config file. From web.config the author obtained the mail server API key, IIS server admin credentials, SMS API keys and payment gateway keys.
The author states that these keys could be used to send mail from the enterprise mail server, send SMS to customers, and perform payment manipulation, among other actions. The report does not quantify how many customers or transactions were affected, and does not show the abuse of the keys beyond stating that it was possible.
Fix
It only records the timeline: the bug was reported to the company on 19 June 2016, marked fixed on 11 July 2016, re-tested and confirmed fixed the same day, and the author was awarded by the company on 1 August 2016. What was changed in the application is not stated.
Variants to test
- Traversal in file-serving parameters. Take any parameter that names a file, template, language pack or report, and substitute relative traversal sequences aimed at a known system file. A positive result is the contents of that file coming back in the response.
- IIS-specific targets. On servers whose
Serverheader indicates IIS, try readingWIN.INIfirst as a low-risk confirmation, then application files such as the login page source andweb.config. A positive result is readable source or configuration content rather than an error page. - Source disclosure of any page. Once one page's source is readable, request the source of other pages by the same relative path. A positive result is server-side source code returned instead of rendered output.
- Secret extraction from configuration files. Where
web.configor equivalent configuration files are reachable, look for mail, SMS, payment and admin credentials. A positive result is live-looking keys or credentials in the response. - Encoding and normalisation bypasses. If plain traversal is filtered, try encoded variants of the traversal sequences and observe whether the same files are returned. A positive result is the same file content despite the filter.
What happened, in plain words
A security researcher was hunting for bugs on what he describes as India's largest online health platform website. While testing, he found that the site would happily hand over files from its own server to anyone who asked in the right way. The trick he used is called a path traversal attack, and it let him read files that were never meant to be public: the source code of the website's pages, and a configuration file called web.config.
That configuration file turned out to contain API keys. An API key is a short secret string, a bit like a password, that lets one piece of software talk to another service on your behalf. Think of it as the key card a hotel gives a member of staff: whoever holds it can open the staff-only doors without proving who they are. The keys in this file belonged to the company's mail server, its SMS service, its payment gateway and its IIS web server administration. With those keys, the author says he could send email from the company's enterprise mail server and send SMS messages to their customers.
This article walks through exactly how he did it, step by step, assuming you know nothing about security beyond using a browser.
The idea behind the bug
Every website is really a program running on a computer somewhere, called a server. When you visit a page, your browser sends a request over the internet, and the server sends back a response: usually a web page, sometimes an image, sometimes data.
Servers store files on their disk, just like your own computer does. A web server is normally configured so that only certain folders are reachable from the internet, the ones holding the public website. Files outside those folders, such as the program's own source code or configuration files, are supposed to be off limits.
A path traversal attack tries to break that rule. Many web addresses contain a file name or folder name, for example something like page=about.html. If the server takes whatever the visitor typed and uses it directly to find a file on disk, a visitor can type something clever instead of a normal file name. The clever part is the sequence ../, which in file paths means "go up one folder". Chain a few of those together and you can climb out of the public folder and into parts of the disk you were never meant to see. It is like being told "take the leaflet from the rack by the front door" and instead walking through the staff door, up the stairs and into the manager's office, because nobody checked that you stayed by the front door.
When a server lets this happen, the weakness is often called local file inclusion: the application includes a local file in its response, and the visitor gets to choose which one.
Finding it
The author found the problem in a URL and a parameter. A parameter is the part of a web address after a question mark that carries extra information, like the q in a search address. The report does not spell the URL or the parameter out as text; they are only visible in the screenshot below.

Vulnerable URL
Why this step matters: before you can exploit anything, you need to know which part of the request the server is trusting. The author found the vulnerability in the URL and the parameter shown in the screenshot.
The response to that request looked like this.

Vulnerable Request response
A response contains headers and a body. Headers are small labelled lines of metadata that the server sends before the actual content, a bit like the information printed on the outside of an envelope before you open it. One of those headers is called Server, and it usually names the software serving the site.
Looking at that response, the author noticed the Server header and concluded that a Microsoft-IIS web server was in use. IIS is Microsoft's web server software, the Windows equivalent of Apache or nginx. That single detail shaped everything that followed: knowing the server was IIS told the author roughly how the folders on disk would be arranged, because IIS follows Windows conventions. With that mental map, he could aim his traversal at Windows system files and at the application's own files by relative path.
Exploitation
Step 1: Confirm file read with WIN.INI
With IIS identified, the author tried to open the Windows WIN.INI file using path traversal.

Path traversal atatck
Why this step: WIN.INI is an old, harmless settings file that ships with Windows and sits in a predictable place. Reading it is a safe way to prove that file reading works, because the file contains nothing secret. If it comes back, you know the door is open.
The response came back as follows.

HTTP Response
The author identifies this response as the content of the WIN.INI file, which confirmed that a local file inclusion vulnerability existed. In other words, the server had just handed over a file from its own operating system to a random visitor on the internet. The report does not reproduce the payload as text; it is only visible in the screenshot above.
Step 2: Read application source code
With file reading confirmed, the author escalated and tried to read the source code of the application. Source code is the human-written program that the server runs. Visitors normally only ever see the output, the finished web page, never the recipe behind it. Reading the source is valuable because it can reveal how the site works, where it stores things and what it trusts.
Because the server was IIS, the author says the application directory layout was clear, and the first target was the source code of the login page.

Login page source code request
The response came back as expected.

Login page source code
The author states that, in the same way, the complete source code of any page of the application could be downloaded. Once one file is reachable by climbing out of the public folder, every other file in the same place is reachable by the same route.
Step 3: Read web.config and extract secrets
The critical step was reading the web.config file. On IIS, web.config is the main settings file for a web application. It is where the site keeps things like database connection details and, as it turned out here, the keys it uses to talk to outside services.

Web Config file inclusion
When the author saw the response to that request, they say they had a huge smile on their face.


According to the author, all the sensitive API keys were exposed: the mail server API key, IIS server admin credentials, SMS API keys and payment gateway keys. Admin credentials are the username and password of an administrator account, the highest level of access on the server. The author describes this as really critical and states that these keys could be used to send mails, send SMS to users, perform payment manipulation and several more actions. The report does not show the contents of web.config as text, so the specific keys and values are only visible in the screenshots.
Why it worked
The report does not describe the application code or the exact parameter handling that allowed the traversal. The author's reasoning implies that the IIS directory layout made it easy to target both Windows system files and application files such as the login page source and web.config.
The exposure of web.config is the key amplifier: on IIS, that file commonly holds connection strings and application secrets, and here it held mail, SMS, payment gateway and IIS admin credentials.
What an attacker could do with it
Under the conditions shown, an attacker who can reach the vulnerable URL and parameter could read files such as WIN.INI, the source code of pages and the web.config file. From web.config the author obtained the mail server API key, IIS server admin credentials, SMS API keys and payment gateway keys.
The author states that these keys could be used to send mail from the enterprise mail server, send SMS to customers, and perform payment manipulation, among other actions. The report does not quantify how many customers or transactions were affected, and does not show the abuse of the keys beyond stating that it was possible.
How it was fixed
It only records the timeline: the bug was reported to the company on 19 June 2016, marked fixed on 11 July 2016, re-tested and confirmed fixed the same day, and the author was awarded by the company on 1 August 2016. What was changed in the application is not stated.
Similar things to test
- Traversal in file-serving parameters. Take any parameter that names a file, template, language pack or report, and substitute relative traversal sequences aimed at a known system file. A positive result is the contents of that file coming back in the response.
- IIS-specific targets. On servers whose
Serverheader indicates IIS, try readingWIN.INIfirst as a low-risk confirmation, then application files such as the login page source andweb.config. A positive result is readable source or configuration content rather than an error page. - Source disclosure of any page. Once one page's source is readable, request the source of other pages by the same relative path. A positive result is server-side source code returned instead of rendered output.
- Secret extraction from configuration files. Where
web.configor equivalent configuration files are reachable, look for mail, SMS, payment and admin credentials. A positive result is live-looking keys or credentials in the response. - Encoding and normalisation bypasses. If plain traversal is filtered, try encoded variants of the traversal sequences and observe whether the same files are returned. A positive result is the same file content despite the filter.
Glossary
- API: a way for one piece of software to talk to another, like a service counter where you hand over a request and get a response back.
- API key: a secret string, similar to a password, that identifies and authorises software calling an API.
- Bug bounty: a programme where companies pay researchers for reporting security problems to them.
- Configuration file: a file that holds a program's settings, such as addresses, connection details and secret keys.
- Credentials: a username and password (or similar pair) used to prove identity.
- Header: a labelled line of metadata sent with an HTTP request or response, such as
Server. - HTTP: the protocol browsers and servers use to exchange requests and responses.
- IIS: Microsoft's web server software for Windows.
- Local file inclusion: a weakness where an application lets a visitor choose a file on the server to be included in its response.
- Parameter: the part of a web address after a question mark that carries extra information to the server.
- Path traversal: a technique using
../sequences to climb out of an intended folder and reach other files on disk. - Payload: the specific crafted input sent to trigger a vulnerability.
- Request: the message a browser sends to a server asking for something.
- Response: the message a server sends back, containing headers and a body.
- Root cause: the underlying reason a vulnerability exists, as opposed to its visible symptom.
- Server: the computer (and software) that stores a website and answers requests for it.
- Source code: the human-written program that a server runs, normally hidden from visitors.
- Web root: the folder on a server that is meant to be publicly reachable.
web.config: the main settings file for an IIS web application.WIN.INI: an old Windows settings file, often used as a harmless test target when checking for file read.