[MDEV-33267] User with minimal permissions can intentionally corrupt mysql.slow_log table Created: 2024-01-17 Updated: 2024-01-25 Resolved: 2024-01-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server, Variables |
| Affects Version/s: | 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3 |
| Fix Version/s: | 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Unlike general_log table which stores the global time as event_time, slow_log table uses a session timestamp as start_time. Combining these two oddities, an unpleasant result can be achieved:
The test above represents a server running with slow logging written into the system table. When after that anyone runs another query to be written into the slow log, no visible problem occurs:
and a CHECK on the slow log table also doesn't show anything:
However, an attempt to read from the table returns an error (it is masked in the test case):
Repair fixes the table at the expense of removing the guilty record, but everything that was [supposed to be] written after it is also lost:
So, the low-privileged user effectively stops the whole server from writing into the slow log table, invisibly for anyone until somebody tries to query the table. One possible workaround is restricting TIMESTAMP permissions by setting secure_timestamp=SUPER. MDEV-32188 (32-bit timestamp) targeted for 11.4 seems to fix the issue, at least for 64-bit builds – no corruption is observed after setting timestamp to 4294967295 in the otherwise same scenario. start_time for the guilty query still overflows, but seemingly innocently, and doesn't affect other records:
|