How @Mailru traeted my report on their program
A debug-mode error page on a Mail.ru subdomain exposed database credentials, and the reporter used them to reach an open PostgreSQL port and read data. The program disputed the impact, changed the scope, and eventually paid a reduced bounty.
Mailru
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
Mail.ru runs a public bug bounty programme, and this write-up covers a report the author, Ayoub (@yukusawa18 on HackerOne), filed against it in 2021. The target was a set of hosts under *.corp.mail.ru, specifically [redacted].mail.ru and [redacted].mail.ru, and the author also reached api.legium.io. The author had previously reported an S3 bucket issue, and later re-checked the response on [redacted].mail.ru.
The report is as much about the triage process as about the technical finding. The author states up front that he had good experiences with other Mail.ru triagers but a bad one this time, and he walks through the timeline step by step.
Setup
The tools involved are minimal and are all named in the report:
- A browser, to browse
*.corp.mail.rusubdomains and read the debug error page. - Reading of static JavaScript files served by the application.
psql, the PostgreSQL interactive terminal, documented athttps://www.postgresql.org/docs/13/app-psql.html, to connect to the database once credentials and a host were known.- A port check against
api.legium.ioon port5432.
No accounts, roles or special access are described. The precondition was simply that the debug page on [redacted].mail.ru was reachable and leaked configuration values, and that the database port was reachable from the internet.
Finding it
The author was enumerating *.corp.mail.ru subdomains and found one that returned a 500 Internal Server Error with debug mode enabled, leaking a lot of information. On 21 January 2021 he submitted bug #1083543 to Mail.ru about debug mode being enabled on [redacted].mail.ru.

The first bug was about an S3 bucket containing a lot of images, specifically passports. The bucket name was disclosed in the configuration as:
AWS_STORAGE_BUCKET_NAME = 'legium-media'
The author points out that the bucket name contains legium. On 2 February 2021 he was rewarded 7.5k for the information disclosure, and on 20 April 2021 the bug was fixed and the S3 credentials were changed, so the bucket was no longer accessible.
Two months later he decided to re-check the response and the information found on [redacted].mail.ru. By accident he found that the page also exposed database credentials:

The problem was that the credentials alone did not include the IP needed to connect to the database. He looked for it by reading all the JavaScript files on https://[redacted].mail.ru, and found a subdomain in one of them:
https://[redacted].mail.ru/static/api.js

That file referenced api2.legium.io. The host api2.legium.io did not work, so he deleted the 2 and visited api.legium.io, which worked. He then checked whether api.legium.io had port 5432 open, and found that it did.
Exploitation
Step 1: Read the debug page for database credentials
The starting point was the debug error page on [redacted].mail.ru, which exposed database credentials. The report shows the credentials in a screenshot rather than as text.
Step 2: Find the database host in static JavaScript
With credentials but no host, the author read the JavaScript files served by the application. The relevant file was:
https://[redacted].mail.ru/static/api.js
It contained a reference to api2.legium.io. That hostname did not resolve or respond, so he removed the 2 and tried api.legium.io, which worked.
Step 3: Confirm PostgreSQL is exposed
He checked whether api.legium.io had port 5432 open, and found that it did. Port 5432 is the default PostgreSQL port, so this suggested the database itself was reachable from the internet.
Step 4: Connect with psql
He connected to the database using the psql tool, linking to the PostgreSQL 13 documentation for psql. The report does not reproduce the connection command.
Step 5: Report, and watch the target change
He reported the bug on 23 June 2021 at 3:59am. Hours after the report, the team deleted the two subdomains, https://[redacted].mail.ru and https://[redacted].mail.ru. The author notes that he had visited them one or two hours before reporting, as shown in the screenshot:

He also states that he could access the admin panel, but that it was hidden before triage, so he could not add an account and access the panel. He told the team that they had hidden the admin panel:

and showed that he had been able to access it a few hours before reporting:

Step 6: Triage and scope changes
The bug was triaged on 24 June 2021 at 09:32:30 +01:

The author remarks that almost every hacker who has worked on the Mail.ru team knows that in 99% of reports with a wrong scope, the triager changes it before triage. In this case, after 8 or 9 days a new triager changed the scope from EXT.A, where *.corp.mail.ru applied, to something else:

He asked why the scope had been changed and pointed to information on *.corp.mail.ru:

Then the team changed the scope again, which the author describes as wanting to punish him more, and he notes that after 14 days they still did not know what the scope was:

Step 7: The bounty decision
Mail.ru decided the report was not eligible for a bounty because, in their words, the IP was only for testing:

The author states that he found 325 MB of data on the database, exactly in the table case_case, containing a lot of agreements, on the IP they called a testing IP. He added comments to complain about the decision:

A few days later he received a reward of 150 USD:

Step 8: The dispute about the data
He continued to complain and told them that he had accessed information related to famous persons in Russia. The answer was that it was still only a test database, and he provided evidence that it was not:

He was also told that Mail.ru and Legium had no relation:

and the report includes a translation of that message:

He closes with five questions to the team:
- If there is no relation between Mail.ru and Legium, why was he paid for the S3 bucket
legium-data, which does not belong to Mail.ru? - Why did
https://[redacted].mail.ruandhttps://[redacted].mail.ruexist? - Why does
https://skillbox.legium.io, which belongs to Mail.ru, exist? - If they are not partners, why did they fix the bugs and add a 403 to the admin panel before triage?
- Even if the IP does not belong to Mail.ru, why was it found on
https://[redacted].mail.ru?
Root cause
The technical root cause is a debug mode left enabled on [redacted].mail.ru, which returned a 500 Internal Server Error page that disclosed configuration values, including database credentials. The same debug output had earlier disclosed the S3 bucket name and credentials. The database host was not in the debug output but was recoverable from a static JavaScript file, https://[redacted].mail.ru/static/api.js, which referenced api2.legium.io; the working host was api.legium.io. Finally, the PostgreSQL port 5432 on api.legium.io was reachable from the internet, so the leaked credentials were directly usable with psql.
In design terms, the defences that should have stopped this are: debug mode off in production, secrets kept out of error pages and client-side JavaScript, and the database not exposed to the public internet. The report shows debug mode was on and the database port was reachable from the internet. The report does not describe the application code itself, so the exact mechanism that produced the debug page is not stated.
Impact
The author reports that he connected to the database and found 325 MB of data in the table case_case, containing a lot of agreements. He also states that he accessed information related to famous persons in Russia, and that he could access the admin panel before it was hidden. The earlier, related report concerned an S3 bucket containing passports.
The programme's position, as quoted in the report, was that the IP was only for testing and that the database was a test database, and later that Mail.ru and Legium had no relation. The author disputes both points. The final outcome recorded in the report is a reward of 150 USD. The report does not give a CVSS score or a formal severity rating.
Fix
The report describes what the team did rather than what should be done. After the report, the team deleted the two subdomains https://[redacted].mail.ru and https://[redacted].mail.ru, and the admin panel was hidden before triage, with a 403 added. The earlier S3 issue was fixed and the S3 credentials were changed.
What should be done, based on the finding: disable debug mode in production so error pages do not disclose configuration; keep credentials out of error output and out of static JavaScript; restrict the database to private networks or authorised sources rather than exposing 5432 publicly; and rotate any credential that has appeared in a response.
Variants to test
- Request a non-existent path or malformed parameter on other
*.corp.mail.ruhosts and look for a500page with stack traces or configuration values. A positive result is a response that names internal services, bucket names or credentials. - Fetch every JavaScript file under
/static/on in-scope hosts and grep for hostnames, API endpoints and keys. A positive result is a reference to an internal or alternate host such asapi2.legium.iothat leads to a reachable service. - For each hostname found, try removing or changing numeric prefixes and subdomain labels, as was done with
api2.legium.iotoapi.legium.io. A positive result is a host that resolves and serves the same application. - Check default database ports (
5432for PostgreSQL, and the equivalents for other engines) on hosts discovered this way. A positive result is an open port that accepts a connection from the internet. - Where credentials are found, test them with the matching client, here
psql, against the discovered host. A positive result is a successful login and a listing of tables. - Compare the target's behaviour before and after a report is filed: check whether admin panels, subdomains or endpoints that were reachable become hidden or return
403. A change of this kind is worth documenting with timestamps, as the author did.
What happened, in plain words
A security researcher found a Mail.ru web server that, when something went wrong, showed a long technical error page to anyone who visited it. That page accidentally included the username and password for a database. He connected to the database with psql and found a large amount of data. He reported it, and the programme first said the database was only a test system, then paid him 150 USD. A lot of the write-up is about how the report was handled: the scope of the programme was changed twice, the two subdomains were deleted shortly after he reported, and the team later said Mail.ru and the company behind the servers had no relation.
This article walks through the same steps in the same order, but explains every idea from scratch. If you can use a browser, you can follow it.
Some words you will meet first
Before the timeline, a few everyday ideas. Each one is explained again where it first matters.
- A subdomain is a name that sits in front of a main domain. In
[redacted].mail.ru, the main domain ismail.ru,corpis a subdomain of it, andlegium-backis a subdomain ofcorp. Companies use subdomains to give each internal service its own name, a bit like flat numbers inside one building. - A bug bounty programme is a public offer from a company: if you find a security problem in our systems and tell us privately, we may pay you a reward (a bounty). HackerOne is a website where many such programmes are listed and where reports are filed.
- A triager is the person on the company side who first reads a report, checks that it is real, and decides whether it is in scope and what it is worth. Triage is that first review.
- Scope is the list of systems a programme agrees to pay for. If you report something outside the scope, the company may still fix it but is not obliged to pay. Triagers sometimes correct a wrong scope themselves.
- Debug mode is a setting developers turn on while building software so that when something breaks, the software prints lots of detail to help them fix it. It is meant for development machines, not for servers the public can reach.
- An API (application programming interface) is the part of a service that other software talks to, rather than a human with a browser. Think of a restaurant: the dining room is the website you see, the kitchen door where orders are passed is the API.
- A port is a numbered door on a computer. One machine can run many services, and each listens on its own number. Port
5432is the default door for PostgreSQL, a popular database program. - Credentials means the pair of a username and a password (or similar) that lets you log in.
- S3 bucket is a storage container in Amazon's cloud (Simple Storage Service). People put files in it, and if it is misconfigured, anyone on the internet can list and download those files.
- Static files are files a web server hands out unchanged, such as images, style sheets and JavaScript. JavaScript is the code that runs in your browser and makes pages interactive; it is also readable by anyone, so it should never contain secrets.
- psql is the official command-line client for PostgreSQL. You type a command, it connects to the database and lets you run queries.
- 403 is the HTTP status code for "forbidden": the server understood your request but refuses to serve it.
- 500 Internal Server Error is the status code for "something broke on the server side".
The setup
The tools in this story are few, and the report names them all:
- A browser, to visit
*.corp.mail.rusubdomains and read the error page. The*is a wildcard meaning "any name here". - Reading the JavaScript files the application serves, which any browser can download and any text editor can open.
psql, the PostgreSQL terminal, documented athttps://www.postgresql.org/docs/13/app-psql.html, to connect to the database once a username, password and address were known.- A check whether port
5432onapi.legium.iowas open, that is, whether the database door was reachable from the internet.
No account or special permission is described. The only preconditions were that the error page on [redacted].mail.ru was reachable and leaked settings, and that the database port could be reached from outside.
Finding it
The author was going through subdomains under *.corp.mail.ru, the kind of internal-looking names companies use for their own services. He found one that answered with a 500 Internal Server Error and, because debug mode was on, printed a great deal of internal information instead of a short apology page.
On 21 January 2021 he submitted bug #1083543 to Mail.ru about debug mode being enabled on [redacted].mail.ru.

The screenshot shows the first bug as it was submitted to Mail.ru.
That first report was about an S3 bucket holding many images, specifically passports. The bucket's name appeared in the leaked configuration as:
AWS_STORAGE_BUCKET_NAME = 'legium-media'
Line by line: AWS_STORAGE_BUCKET_NAME is the name of a setting, the label the application uses internally to refer to its storage bucket. The equals sign assigns a value to it. 'legium-media' is that value, written in quotes because it is text. So the application was telling anyone who read the error page which cloud storage container it used. The author points out that the name contains legium.
On 2 February 2021 he was rewarded 7.5k for the information disclosure. "Information disclosure" simply means the system revealed something it should have kept private. On 20 April 2021 the bug was fixed and the S3 credentials were changed, so the bucket could no longer be accessed.
Two months later he decided to look again at the response and the information found on [redacted].mail.ru. By accident he noticed that the page also exposed database credentials:

The screenshot shows the database credentials found on https://[redacted].mail.ru.
The difficulty was that a username and password are useless without knowing which machine to connect to. He needed the IP to connect to the database, so he read the JavaScript files. So he read all the JavaScript files served by https://[redacted].mail.ru, looking for a hostname. Reading JavaScript is not exotic: your browser downloads those files to run them, and you can open the same files yourself.
He found a subdomain inside one of them:
https://[redacted].mail.ru/static/api.js
This is a URL. https:// is the secure web protocol. [redacted].mail.ru is the server. /static/api.js is the path of a file on that server: a JavaScript file named api.js inside a folder called static. The name suggests it holds the code the front end uses to talk to the API.

The screenshot shows that this response mentions api2.legium.io.
That file referenced api2.legium.io. That host did not work, so he deleted the 2 and visited api.legium.io, which worked. This is a common trick: services are often given numbered names, and the same application may answer on a neighbouring name. He then checked whether api.legium.io had port 5432 open, and found that it did. Since 5432 is PostgreSQL's default door, that suggested the database itself was reachable from the internet.
Exploitation
Step 1: Read the debug page for database credentials
The starting point was the debug error page on [redacted].mail.ru, which exposed database credentials. The report shows them in a screenshot rather than as text, so they are not reproduced here.
Why this step: a debug page is a gift to a researcher because it is written for developers, not for visitors. It tends to name internal services, file paths and settings, and sometimes secrets.
Step 2: Find the database host in static JavaScript
With credentials but no address, the author read the JavaScript files served by the application. The relevant file was:
https://[redacted].mail.ru/static/api.js
Again: secure protocol, server name, then the path /static/api.js. It contained a reference to api2.legium.io. That hostname did not respond, so he removed the 2 and tried api.legium.io, which worked.
Why this step: front-end code has to know where the API lives in order to call it, so hostnames are often written into it. Developers sometimes forget that this code is public.
Step 3: Confirm PostgreSQL is exposed
He checked whether api.legium.io had port 5432 open, and found that it did. Port 5432 is the default PostgreSQL port, so this suggested the database itself was reachable from the internet.
Why this step: credentials only help if you can reach the service that accepts them. A database that only listens on a private network cannot be reached from outside even with a valid password.
Step 4: Connect with psql
He connected to the database using the psql tool, linking to the PostgreSQL 13 documentation for psql. The report does not reproduce the connection command.
Why this step: psql is the standard client for PostgreSQL. Once you have a host, a port, a username and a password, it lets you log in and run queries, much like a browser lets you open a website.
Step 5: Report, and watch the target change
He reported the bug on 23 June 2021 at 3:59am. Hours after the report, the team deleted the two subdomains, https://[redacted].mail.ru and https://[redacted].mail.ru. The author notes that he had visited them one or two hours before reporting, as the screenshot shows:

The screenshot shows [redacted].mail.ru still accessible at that earlier moment.
He also states that he could access the admin panel, but that it was hidden before triage, so he could not add an account and access the panel. An admin panel is the private management page of an application, where staff create accounts, change settings and see data. He told the team that they had hidden the admin panel:

The screenshot shows that message to the team about the admin panel being hidden.
and showed that he had been able to reach it a few hours before reporting:

The screenshot shows the admin panel accessible a few hours before the report.
Why this matters: if a system changes between the moment you observe a problem and the moment the company looks at it, the company may not be able to reproduce what you saw. Keeping dated screenshots is how you show what was there.
Step 6: Triage and scope changes
The bug was triaged on 24 June 2021 at 09:32:30 +01:

The screenshot shows the status changed to triaged.
The author remarks that almost every hacker who has worked on the Mail.ru programme knows that in 99% of reports with a wrong scope, the triager changes it before triage. In other words, a scope mistake is normally corrected quietly by the company. Here, after 8 or 9 days, a new triager changed the scope from EXT.A, where *.corp.mail.ru applied, to something else:

The screenshot shows the scope changed to "acquisitions".
He asked why the scope had been changed and pointed to information on *.corp.mail.ru:

The screenshot relates to that exchange about the scope.
Then the team changed the scope again, which the author describes as wanting to punish him more, and he notes that after 14 days they still did not know what the scope was:

The screenshot relates to the second scope change.
Why this matters: scope decides whether a report is paid. Moving the scope after a report is filed changes whether the finding counts, so the author treats each change as significant and documents it.
Step 7: The bounty decision
Mail.ru decided the report was not eligible for a bounty because, in their words, the IP was only for testing:

The screenshot shows that message about the IP being used only for testing.
An IP address is the numeric address of a machine on a network, the equivalent of a street address. The company's argument was that the machine he reached was a test machine, not a real one, so the data on it did not matter.
The author states that he found 325 MB of data on the database, exactly in the table case_case, containing a lot of agreements, on the IP they called a testing IP. A table is how a database stores rows of related records, like one sheet in a spreadsheet. He added comments to complain about the decision:

The screenshot shows the impacts he listed.
A few days later he received a reward of 150 USD:

The screenshot shows the reward of 150 USD.
Step 8: The dispute about the data
He continued to complain and told them that he had accessed information related to famous persons in Russia. The answer was that it was still only a test database, and he provided evidence that it was not:

The screenshot relates to the reply still calling it a test database.
He was also told that Mail.ru and Legium had no relation:

The screenshot relates to that statement about no relation.
and the report includes a translation of that message:

The screenshot relates to the translation.
He closes with five questions to the team:
- If there is no relation between Mail.ru and Legium, why was he paid for the S3 bucket
legium-data, which does not belong to Mail.ru? - Why did
https://[redacted].mail.ruandhttps://[redacted].mail.ruexist? - Why does
https://skillbox.legium.io, which belongs to Mail.ru, exist? - If they are not partners, why did they fix the bugs and add a 403 to the admin panel before triage?
- Even if the IP does not belong to Mail.ru, why was it found on
https://[redacted].mail.ru?
Why this matters: these questions are about consistency. If the two companies were unrelated, the author argues, the servers, the fixes and the earlier payment would not make sense.
Root cause
The technical root cause is a debug mode left enabled on [redacted].mail.ru, which returned a 500 Internal Server Error page that disclosed configuration values, including database credentials. The same debug output had earlier disclosed the S3 bucket name and credentials. The database host was not in the debug output but was recoverable from a static JavaScript file, https://[redacted].mail.ru/static/api.js, which referenced api2.legium.io; the working host was api.legium.io. Finally, the PostgreSQL port 5432 on api.legium.io was reachable from the internet, so the leaked credentials were directly usable with psql.
In design terms, three defences should have stopped this: debug mode off in production, secrets kept out of error pages and client-side JavaScript, and the database not exposed to the public internet. The report shows debug mode was on and the database port was reachable from the internet. The report does not describe the application code itself, so the exact mechanism that produced the debug page is not stated.
Impact
The author reports that he connected to the database and found 325 MB of data in the table case_case, containing a lot of agreements. He also states that he accessed information related to famous persons in Russia, and that he could access the admin panel before it was hidden. The earlier, related report concerned an S3 bucket containing passports.
The programme's position, as quoted in the report, was that the IP was only for testing and that the database was a test database, and later that Mail.ru and Legium had no relation. The author disputes both points. The final outcome recorded in the report is a reward of 150 USD. The report does not give a CVSS score or a formal severity rating.
Fix
The report describes what the team did rather than what should be done. After the report, the team deleted the two subdomains https://[redacted].mail.ru and https://[redacted].mail.ru, and the admin panel was hidden before triage, with a 403 added. The earlier S3 issue was fixed and the S3 credentials were changed.
What should be done, based on the finding: disable debug mode in production so error pages do not disclose configuration; keep credentials out of error output and out of static JavaScript; restrict the database to private networks or authorised sources rather than exposing 5432 publicly; and rotate any credential that has appeared in a response. Rotating means replacing a secret with a new one and invalidating the old one, the same way you change a lock after losing a key.
Variants to test
These are the same ideas applied to other targets, written so you can try them with a browser and a little patience.
- Request a non-existent path or a malformed parameter on other
*.corp.mail.ruhosts and look for a500page with stack traces or configuration values. A positive result is a response that names internal services, bucket names or credentials. - Fetch every JavaScript file under
/static/on in-scope hosts and search them for hostnames, API endpoints and keys. A positive result is a reference to an internal or alternate host such asapi2.legium.iothat leads to a reachable service. - For each hostname found, try removing or changing numeric prefixes and subdomain labels, as was done with
api2.legium.iotoapi.legium.io. A positive result is a host that resolves and serves the same application. - Check default database ports (
5432for PostgreSQL, and the equivalents for other engines) on hosts discovered this way. A positive result is an open port that accepts a connection from the internet. - Where credentials are found, test them with the matching client, here
psql, against the discovered host. A positive result is a successful login and a listing of tables. - Compare the target's behaviour before and after a report is filed: check whether admin panels, subdomains or endpoints that were reachable become hidden or return
403. A change of this kind is worth documenting with timestamps, as the author did.
Glossary
- 403: HTTP status code meaning the server refuses to serve the request, even though it understood it.
- 500 Internal Server Error: HTTP status code meaning something failed on the server side.
- Admin panel: the private management page of an application where staff manage accounts, settings and data.
- API: the part of a service that other software talks to, as opposed to the pages a person clicks.
- Bounty: a reward paid by a company for a valid security report.
- Bug bounty programme: a company's public offer to pay for privately reported security problems.
- Credentials: a username and password (or similar pair) used to log in.
- CVSS: a standard scoring system for the severity of a security issue; the report gives no score.
- Database: software that stores and organises data in tables so it can be searched and changed.
- Debug mode: a development setting that makes software print detailed internal information when something fails.
- Endpoint: a specific address on a server that accepts requests, such as a particular path or API route.
- Host / hostname: the name of a machine on a network, such as
api.legium.io. - HTTP status code: a number a web server returns with every response to say how it went, such as 200 for success, 403 for forbidden, 500 for server error.
- Information disclosure: a flaw where a system reveals data it should have kept private.
- IP address: the numeric address of a machine on a network.
- JavaScript: the programming language browsers run to make pages interactive; its files are public and readable.
- Port: a numbered door on a computer through which a particular service is reached;
5432is PostgreSQL's default. - PostgreSQL: a popular open-source database program.
- psql: the official command-line client for connecting to and querying PostgreSQL.
- Rotate (a credential): replace a secret with a new one and invalidate the old one.
- S3 bucket: a storage container in Amazon's cloud storage service, used to hold files.
- Scope: the list of systems a bug bounty programme agrees to pay for.
- Static file: a file a web server hands out unchanged, such as an image, style sheet or JavaScript file.
- Subdomain: a name placed in front of a main domain, such as
legium-backin[redacted].mail.ru. - Table: a structured set of rows in a database, like one sheet in a spreadsheet.
- Triage: the first review of a report by the company, where it is checked and classified.
- Triager: the person on the company side who performs triage.
- URL: the full address of something on the web, including protocol, host and path.
- Wildcard (
*): a symbol meaning "any name here", as in*.corp.mail.ru.