[MDEV-13353] CONNECT engine table_type=JDBC should not require FILE priv Created: 2017-07-19 Updated: 2018-04-26 Resolved: 2018-02-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.1.25 |
| Fix Version/s: | 10.0.35, 10.1.32, 10.2.14, 10.3.6 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Robert Dyas | Assignee: | Olivier Bertrand |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOS7 on Google Compute Engine |
||
| Issue Links: |
|
||||||||
| Description |
|
For security reasons it would be great if we did not have to grant FILE permission to everyone who uses a CONNECT JDBC table. Currently we have to grant FILE to all users, even non-administrators, which increases the chance of data being leaked by accident. We do use secure_file_priv to help this, but ideally no user would need FILE priv, or if that isn't possible for some reason, at least not require FILE to use a connect JDBC table. |
| Comments |
| Comment by Elena Stepanova [ 2017-07-20 ] |
|
We have this one already, MDEV-4500. Please feel free to provide your input there. |
| Comment by Robert Dyas [ 2017-07-20 ] |
|
Thank you Elena, I have commented there. That other submission I think was made generally for CONNECT, not specifically for the JDBC table type which has no apparent need for FILE permission. |
| Comment by Elena Stepanova [ 2017-07-20 ] |
|
Okay, I see. I'll re-open it and will keep it related to MDEV-4500 – maybe it will get fixed faster in the limited scope of JDBC than in the wide scope of the whole CONNECT world. |
| Comment by Robert Dyas [ 2018-02-21 ] |
|
Is is yet possible to move forward on fixing this? |
| Comment by Olivier Bertrand [ 2018-02-21 ] |
|
I agree with you. This is the same for many other table types, for instance ODBC. The issue is that it is handled by the function ha_connect::check_privileges that was written by Alexander Barkov when he was working with me. It's not a trivial function and I'd prefer that he was the one to fix this. |
| Comment by Robert Dyas [ 2018-02-21 ] |
|
What is the process to get him to take a look at this? |
| Comment by Alexander Barkov [ 2018-02-22 ] |
|
The reason why we added the requirement for the FILE privilege for ODBC tables was that when accessing such tables, ConnectSE loads local files, e.g. odbc.ini. I agree that FILE privilege might be too strict for ODBC and JDBC, MYSQL, MONGO, MAC, WMI. I can see three options from a glance: 1. Add a new MariaDB privilege, say "API", to control access to system files through APIs (like odbc.ini in case of ODBC). 2. Add new CONNECT system variables to choose if the FILE privilege is required for certain table types, e.g. 3. Just allow to use these mentioned table types without the FILE privilege. Robert, which do you think looks most reasonable? Do you have more ideas? |
| Comment by Robert Dyas [ 2018-02-22 ] |
|
If I understand correctly (please confirm or correct) the different CONNECT types internally read system files. If for example, ODBC.ini is read and contains passwords, this should be OK so long as the database user can't directly access those passwords or read the file directly. On the surface, this is no different than Innodb reading its file tables, which does not require FILE priv. I do think there needs to be very clear documentation, broken out by CONNECT type, that specifies which system files are read and/or written to. If they are just READ and never written, and if the info in them is not exposed by CONNECT directly, on the surface I can't see a problem. If my understanding is correct, then I think option 3 is the best (do not require FILE priv for ODBC and JDBC, MYSQL, MONGO, MAC, WMI). In addition, what about having an option to disable specific CONNECT types completely (a non-dynamic setting, so requires reboot to change). All existing CONNECT types can be enabled by default (for compatibility), and all future CONNECT types can be DISABLED by default so an upgrade doesn't cause unforeseen security issues by accident. Something like this: --connect-odbc-enable=0|1 default 1 For example, our specific config would then enable only jdbc and disable everything else to prevent unforeseen security issues. Alexander, your thoughts? |
| Comment by Olivier Bertrand [ 2018-02-22 ] |
|
For your information: Therefore, I think the better and easier solution is to permit using these table types without requiring the file privilege. About enabling or disabling some table types, I had suggested this for the new MONGO table type (so the CONNECT engine could be rated GA) but this was refused by MariaDB. |
| Comment by Robert Dyas [ 2018-02-22 ] |
|
Thank you for that clarification Olivier. I totally agree with you "the better and easier solution is to permit using these table types without requiring the file privilege" |
| Comment by Olivier Bertrand [ 2018-02-26 ] |
|
No file privilege was not granted for the MYSQL and OEM table types because this would allow executing a table that need the privilege checking. And also not for the DIR, ZIP table types that are using files, even not modifying them. |
| Comment by Sergei Golubchik [ 2018-03-09 ] |
|
I vaguely remember that one can read text and csv files via ODBC, using "Text Driver". Is that correct? |
| Comment by Robert Dyas [ 2018-03-21 ] |
|
I think that is possible, but the person configuring the environment and install the drivers would be "responsible" for installing or not installing such a driver in this case. I don't think its a direct security concern of CONNECT, but could be a vulnerability if someone installed such a driver as the driver can run arbitrary code. Possibly worth documenting in a "Security Considerations" section. |
| Comment by Olivier Bertrand [ 2018-03-23 ] |
|
Text Driver is a 32 bit Windows only driver incompatible with 64 bit applications. All servers on Linux are not concerned, only Windows 32 bit ones (unless accessed via the ODBC-ODBC Easysoft driver). |
| Comment by Robert Dyas [ 2018-03-23 ] |
|
better to not require it in my opinion. |
| Comment by Robert Dyas [ 2018-03-27 ] |
|
I'm not seeing this as fixed in the 10.2.14 change log: |