News for hackers. Stuff that matters.
Re:MySQL Remote Root Code Execution/Privilege Escalation Exp... by terom on Monday September 12, 2016 @08:28AM (#12479094)
EDIT: HN formatting isn't letting me write "asterix dot asterix", it shows up as "." :(

My reading of this is that it requires either mysql root or `GRANT FILE ON . TO ...` privileges? AFAICT this requires an explicit `GRANT FILE ON . TO ...`; just plain `GRANT ALL ON db.* TO ...` does NOT grant any FILE privileges. I assume an install that doesn't give any users FILE privileges is safe?

mysql> SELECT host, user, File_priv FROM mysql.user WHERE File_priv='Y';

AFAICT exploit chain:

* `GRANT FILE ON . TO ...`

* `SELECT unhex("%s") INTO DUMPFILE '%s'`

* ... clever tricks ...

* mysql root

* ... clever tricks ...

* service mysql restart

* system root

The mysql security model for FILE privileges described here seems ridiculous. Your security model relies on creating dumpfiles with `chmod 666` permissions, and rejecting config files that are world-writeable? "I fixed the security issue with world-writable dump files" "You just broken our security model!"

Never grant FILE privileges on a production mysql server?

Re:MySQL Remote Root Code Execution/Privilege Escalation Exp... by ptaipale on Monday September 12, 2016 @09:57AM (#12479683)
Hint: try it as a text after a blank line with two spaces preceding it. https://news.ycombinator.com/formatdoc

Then you can write

  GRANT FILE ON *.* TO
(How to find out? Google.)