Summary of the Issue
By inspecting the HTML source code of the NextcloudPi web panel (https://<host>:4443
), highly sensitive configuration data is exposed. This includes:
- The entire
config.php
content, such as:dbpassword
,dbname
,dbuser
,mail_smtppassword
,secret
,instanceid
, etc.
- Credentials for SMTP servers
- Information disclosure from system logs
- Data loaded in the DOM even if not rendered visibly
- All of this is exposed in the HTML source, making it retrievable even from browser cache after a session
Why This Is a Problem
This is not about GUI access or privilege escalation — it’s a serious information disclosure issue that:
-
Can occur without root access
-
Can occur without needing to be logged in, if cache is locally available
-
Allows an attacker with access to a user’s system to extract secrets after a legitimate session
-
Exposes confidential credentials and internal system structure, including SMTP credentials that could be used for impersonation or spam
Demonstration: Recovering Sensitive Data via Firefox Cache
A real-world scenario: if someone accessed the panel from Firefox, then walked away or deleted their session, the sensitive HTML remains in local browser cache.
Here’s how it can be retrieved:
# Create a working directory
mkdir firefox_cache && cd firefox_cache
# Copy Firefox cache entries (replace xxxxxx with your actual profile)
cp ~/.cache/mozilla/firefox/xxxxxx.default-release/cache2/entries/* .
# Search for sensitive data
grep -i 'dbpassword\|smtp\|config.php' *
# Or search for config form section
grep -il '<div id="config-box">' *
# View the cached HTML
less <filename>
Technical Root Cause
The following PHP lines inject config.php
directly into the web interface:
include( '/var/www/nextcloud/config/config.php' );
They appear in:
/var/www/ncp-web/index.php
/var/www/ncp-web/backups.php
Then, through elements.php
, the form renderer outputs values into the page DOM.
How to Mitigate It
To prevent this exposure:
-
Edit both files mentioned above and comment out the include line:
// include( '/var/www/nextcloud/config/config.php' );
-
Restart Apache:
sudo systemctl restart apache2
-
Clear the browser cache to remove any previously cached HTML.
Recommendations
- Avoid using the NCP panel from shared or untrusted systems
- Whitelist access to the admin panel via IP
- Regularly purge your browser cache after administrative sessions
- Monitor any use of SMTP from your domain in case of leaked credentials
Notes
- This behavior was confirmed in NextcloudPi version 1.55.3 (November 2024 ISO)
- Even a clean install reproduces the issue
- This does not violate access control directly, but constitutes a serious info leak
Let’s work together to raise awareness and secure deployments.
Best regards,
Alex