Skip to content
Info disclosure Disclosed report Beginner

Website PHP source code returned in javascript

A JavaScript file served from the site's theme directory appeared to return PHP server-side source code instead of the expected script. An attacker could read that code, which may contain sensitive values such as credentials or secret keys, and use it to plan further attacks.

mdfarhanchowdhuryhasin Follow

Originally disclosed on HackerOne

Medium 4.8 View original
  • Triaged in 7 hours
  • Fixed in 3 months
  • Disclosed after 4 months

Source code disclosure:

Summary:

Severity : Low Confidence : Tentative Host : https://nextcloud.com Path : /wp-content/themes/theme-package/dist/js/main.js

Issue detail:

The application appears to disclose some server-side source code written in PHP.

Issue background:

Source code intended to be kept server-side can sometimes end up being disclosed to users. Such code may contain sensitive information such as database passwords and secret keys, which may help malicious users formulate attacks against the application.

Issue remediation:

Server-side source code is normally disclosed to clients as a result of typographical errors in scripts or because of misconfiguration, such as failing to grant executable permissions to a script or directory. Review the cause of the code disclosure and prevent it from happening.

References:

Web Security Academy: Information disclosure

Vulnerability classifications:

CWE-18: Source Code
CWE-200: Information Exposure
CWE-388: Error Handling
CWE-540: Information Exposure Through Source Code
CWE-541: Information Exposure Through Include Source Code
CWE-615: Information Exposure Through Comments
CAPEC-37: Retrieve Embedded Sensitive Data

Impact

Source code intended to be kept server-side can sometimes end up being disclosed to users. Such code may contain sensitive information such as database passwords and secret keys, which may help malicious users formulate attacks against the application.

Attachments

Screenshot_2022-12-06_104011.png
Screenshot_2022-12-06_104011.png From the original on HackerOne
Screenshot_2022-12-06_104127.png
Screenshot_2022-12-06_104127.png
Screenshot_2022-12-06_104213.png
Screenshot_2022-12-06_104213.png
Screenshot_2022-12-06_104237.png
Screenshot_2022-12-06_104237.png
Screenshot_2022-12-06_104303.png
Screenshot_2022-12-06_104303.png

The original report as published on HackerOne, by mdfarhanchowdhuryhasin. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a misconfiguration or typo meant a PHP script was served as a static file rather than executed, so its source was returned to the client.

Impact

The disclosed code may contain sensitive information such as database passwords and secret keys, which could help an attacker plan further attacks; the report is marked tentative and low severity.

What the attacker needed

None

The fix

The cause of the disclosure should be reviewed and corrected, for example by ensuring scripts have executable permissions and are not served as static files.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Websites often run code on the server that visitors are never meant to see, such as PHP files. Here a file that should have been a normal JavaScript file instead handed back that hidden server code. Anyone who opened it could read it, and such code sometimes holds passwords or secret keys.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by mdfarhanchowdhuryhasin

View all

1 more disclosed report, best first.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.