Comments on: Percona Responds to MySQL LOCAL INFILE Security Issues https://www.percona.com/blog/percona-responds-to-mysql-local-infile-security-issues/ Thu, 28 Feb 2019 10:17:58 +0000 hourly 1 https://wordpress.org/?v=6.5.2 By: David Busby https://www.percona.com/blog/percona-responds-to-mysql-local-infile-security-issues/#comment-10970268 Fri, 08 Feb 2019 11:13:57 +0000 https://www.percona.com/blog/?p=55149#comment-10970268 Hi Andrew,

Percona Server being downstream of Oracle MySQL (as well as PXC) it makes sense that this would mirror upstream by default (and yes if you enabled local_infile and re-run the tests they are vulnerable to this issue, however what I have highlighted in this post is the default OTB state of each fork and version tested).

There’s no intent to paint Percona Server nor PXC in a positive light, had they been vulnerable by default this would have been noted here regardless, we do not (and should not) show bias to even our own products at Percona.

The difference here was MariaDB was allowing local_infile by default, there should now be workaround fix in place such that if there is no SQL statement issues which would require the server to send the file request packet, if a packet is received it is instead ignored (as noted from MariaDB to myself in email).

w.r.t rogue_mysql_server.py I’d suggest such discrepancies were intentional to ensure only those whom understand the protocol can re-arm the rogue_mysql_server to achieve the desired result, as stated I am waiting on response from a fork at this time and can not go into much detail at the moment on this.

w.r.t the disabling of local_infile; and the vulnerabilities of enabling it again, that is true and for the record I personally think MariaDB has the best proposed workaround here in having the client respond only if SQL is known to have been issued with LOAD … and ignore all other requests if this has not been the case.

_if_ you compile from source and ensure that local_infile support is disabled, and this fits your use case in your deployments, excellent; of course this will protect against this particular issue.

However you have to weigh this against maintaining your own builds for future releases which patch other security vulnerabilities.

The analysis here has been intended to cover all forks, not to paint one or another more or less favourably by any means.

]]>
By: Andrew https://www.percona.com/blog/percona-responds-to-mysql-local-infile-security-issues/#comment-10970267 Fri, 08 Feb 2019 05:00:49 +0000 https://www.percona.com/blog/?p=55149#comment-10970267 This seems to paint Percona in a particularly good light, but ultimately PXC / Percona Server seems to be in the same situation as upstream MySQL. If you disable local-infile at the client level you’re fine, but once local_infile is enabled it seems just as susceptible. The default is off in *some* pre-compiled distribution releases but not if you compile from source or apparently you use the ubuntu packages. Is MariaDB much different if one takes care to disable local_infile?

There is a bug in the rogue_mysql_server.py implementation which underspecifies the salt in the handshake packet which may explain this discrepancy.

]]>
By: David Busby https://www.percona.com/blog/percona-responds-to-mysql-local-infile-security-issues/#comment-10970264 Thu, 07 Feb 2019 10:20:40 +0000 https://www.percona.com/blog/?p=55149#comment-10970264 Hi Federico,

1) The ‘feature abuse’occurs in the client handling of the INFILE packet request from the server, this is made clear in the network flows which unfortunately are redacted at this moment in time, once we’ve had response from the one fork whim has not provided indicate they have made an appropriate response or Feb 28th is reached I will update this post with the redacted detail in line this will provide more clarity on where the abuse / exploitation occurs. As the SQL issues by the client is ignored, the client need not actually send a LOAD XML / LOAD DATA … the malicious server will always just respond with the file request packet and where local_infile is enabled the client will respond with the file contents if accessible. I’ve taken this approach to ensure responsible disclosure practises are followed the rest of this content however is already in the public domain, hence this post has been released with this detail adding testing and mitigation recomendations.

2) This was added as a consideration based on feedback from one of our dev leads, this consideration was for the fix only I’ll follow up with them and query this. As noted in post and in response above, the exploitation ocurrs when the client has local_infile enabled, it will always respond with the file contents if accessible; this allows the ‘server’ to send the packet in responds to any SQL sent in testing.

]]>
By: Federico https://www.percona.com/blog/percona-responds-to-mysql-local-infile-security-issues/#comment-10970260 Wed, 06 Feb 2019 21:23:34 +0000 https://www.percona.com/blog/?p=55149#comment-10970260 I’m happy that this ancient problem is getting proper attention now. Thank you David. A couple of comments:
1) You don’t mention the LOAD XML statement. Is this a mistake or is it more secure for some reason?
2) LOAD DATA is not allowed in stored procedures/functions. And cannot be used as a prepared statement (I mention this because prepared statements can always run in stored procedures).

]]>