Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information disclosure vulnerability with LOAD DATA LOCAL INFILE #334

Closed
bgrainger opened this issue Sep 22, 2017 · 1 comment
Closed

Information disclosure vulnerability with LOAD DATA LOCAL INFILE #334

bgrainger opened this issue Sep 22, 2017 · 1 comment
Labels

Comments

@bgrainger
Copy link
Member

@bgrainger bgrainger commented Sep 22, 2017

A malicious server could respond with 0xFB C:\local\filename.ext to any COM_QUERY request, and MySqlConnector would transmit that file to the server. See https://dev.mysql.com/doc/refman/5.7/en/load-data-local.html for a full description.

The simplest mitigation would be to obfuscate all source file names in MySqlBulkLoader.LoadAsync; that is, if a file name is specified, open it for reading then treat it as a SourceStream. In ResultSet.ReadResultSetHeaderAsync, only allow "file names" that begin with MySqlBulkLoader.StreamPrefix. This would prohibit arbitrary filesystem paths from being requested.

This would break clients who manually construct a LOAD DATA LOCAL INFILE SQL statement and execute it. However this seems to be rare, and has a fairly simple workaround: switch to MySqlBulkLoader. We could also relax the "path must start with MySqlBulkLoader.StreamPrefix" requirement if SslMode is VerifyCA (or higher), as that implies we can trust the server; if we did that, another workaround would be to use a SSL certificate to connect to the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant