Make WordPress Core

Opened 9 months ago

Closed 9 months ago

#62100 closed defect (bug) (wontfix)

Database password shows up in browser if apache mysql module not loaded

Reported by: perryb's profile perryb Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Database Keywords: reporter-feedback
Focuses: Cc:

Description

This might be a niche issue but I thought I'd log it here in case anyone thought it might be worth investigating:

While setting up a WordPress on AWS via a Docker image our Infrastructure Engineer came across an error message in their browser that exposed the database password.

This was triggered by an issue with Terraform in AWS which resulted in the WP image mounting before Apache had been properly configured, so no mysql module and hence the error message.

I'm not really up to speed with AWS so if you need more details I can get them from the engineer, they say that in turn this was triggered by a logged Terraform issue that appears to date back to 2017!

I imagine this is likely an edge case but thought I'd log it in case anyone thought it might be more significant, or possible to trigger in another context.

Attachments (1)

mysql-error.png (101.2 KB) - added by perryb 9 months ago.
Screencap of error message

Download all attachments as: .zip

Change History (5)

@perryb
9 months ago

Screencap of error message

#1 @johnbillion
9 months ago

  • Keywords reporter-feedback added
  • Version 6.6.2 deleted

Thanks for the report @perryb.

Regarding the parameters being shown in the fatal error stack trace, there's nothing that WordPress can do about this except to implement the SensitiveParameter attribute. This is being tracked in #57304.

That said, this error should be caught during the bootstrap process of WordPress when it checks for the existence of the mysqli_connect function here: https://github.com/WordPress/wordpress-develop/blob/fd104aed1427167a8273bc6dc8dc43c1dd66ae02/src/wp-includes/load.php#L174-L204 . I can see from the stack trace that your site is running Query Monitor which likely means the wp-content/db.php file is in place which will cause this check to get skipped. The reason for this is in case a custom database driver is installed and WordPress lets it take over.

If you delete the wp-content/db.php file or deactivate Query Monitor then you should see the appropriate error message about the missing mysqli extension. If that's the case then I think we can close this ticket as there's nothing more that WordPress can do in this case.

#2 @perryb
9 months ago

That's very useful thank you - not least because I'd managed to miss that I still have Query Monitor installed and it needs to come off the production site anyway!

#3 @perryb
9 months ago

Last edited 9 months ago by perryb (previous) (diff)

#4 @johnbillion
9 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

In that case I'll close this off. Cheers!

Note: See TracTickets for help on using tickets.