First published: Tue Oct 05 2010(Updated: )
Description of problem: <a href="http://dev.mysql.com/doc/refman/5.1/en/news-5-1-50.html">http://dev.mysql.com/doc/refman/5.1/en/news-5-1-50.html</a> # Security Fix: Replication: It was possible when using statement-based replication to subvert the MySQL privilege system on a slave with a higher server release version number than that of the master by using version-specific comments in statements run on the master. A more detailed explanation follows: In MySQL, a version-specific comment is an SQL comment of the form /*!nnnnn sql */ where nnnnn represents a MySQL release version number and sql represents a string of SQL, or a portion of a string of SQL, that should be executed by the MySQL Server only if the server version is at least version n.nn. (For additional information and an example, see Section 8.6, “Comment Syntax”.) In MySQL replication, the slave SQL thread executes with the SUPER privilege, regardless of the privileges with which statements are originally executed on the master. Specific to this issue, when using statement-based replication it was possible, when the slave was of a higher MySQL version than the master, to run statements that would have failed on the master due to insufficient privileges, except that these statements were wrapped in version-specific comments where the encoded version was greater than the MySQL server version of the master. However, if the MySQL release version of the slave was equal to or greater than the version encoded in the comment, the same statements could execute on this slave whose MySQL release version was less than the version number used in the comment. Suppose that a master running MySQL 5.1.48 replicated to a slave running MySQL 4.1.49, and that a user user1 had privileges to run UPDATE statements on database db1 but no privileges at all on the mysql system database, so that the first of the following two statements succeeded, but the second statement failed, and thus the first statement was written to the binary log, but the second statement was not: UPDATE db1.tb1 SET db1.tbl1.col1=2; UPDATE mysql.user SET mysql.user.Super_priv='Y' WHERE mysql.user.User='user1'; However, the text of the second statement could be wrapped in version-specific comments and thus “hidden” within the text of the first statement so that this new version of the first statement succeeded, and was written in its entireity to the binary log. The new statement containing the necessary portions of the statement affecting the “mysql.user” table wrapped within version-specific comments is shown here: UPDATE db1.tbl1 /*!514900 ,mysql.user */ SET db1.tbl1.col1=2 /*!514900 ,mysql.user.Super_priv='Y' WHERE mysql.user.User='user1'*/; Thus, a 5.1.48 master would see this statement as identical to the first of the original two statements shown previously (UPDATE db1.tb1 SET db1.tbl1.col1=2). However, the version-specific comments within the statement just shown, when run on the MySQL 5.1.49 slave, were ignored; thus the slave SQL thread would execute the statement, as shown here, with the SUPER privilege, on the slave: UPDATE db1.tbl1,mysql.user SET db1.tbl1.col1=2,mysql.user.Super_priv='Y' WHERE mysql.user.User='user1'; To fix this issue, the ! (exclamation) character is now stripped from comments prior to statements containing them being applied on replication slaves; thus, version-specific comments that are not applied on the master are treated as normal comments on the slave and also not applied there. (<a class="bz_bug_link bz_status_CLOSED bz_closed bz_public " title="CLOSED CANTFIX - Startup script prevents openldap from binding to a specific port" href="show_bug.cgi?id=49124">Bug#49124</a>) Version-Release number of selected component (if applicable): MySQL 5.1.49 How reproducible: see above Steps to Reproduce: 1. see above 2. 3. Actual results: Expected results: Additional info:
Credit: secalert@redhat.com
Affected Software | Affected Version | How to fix |
---|---|---|
redhat/mysql | <5.0.93 | 5.0.93 |
redhat/mysql | <5.1.50 | 5.1.50 |
MySQL MySQL | =5.0.5 | |
MySQL MySQL | =5.0.10 | |
MySQL MySQL | =5.0.0 | |
MySQL MySQL | =5.0.84 | |
MySQL MySQL | =5.0.15 | |
MySQL MySQL | =5.0.17 | |
MySQL MySQL | =5.0.3 | |
MySQL MySQL | =5.0.45-b | |
MySQL MySQL | =5.0.24 | |
MySQL MySQL | =5.0.87 | |
MySQL MySQL | =5.0.2 | |
MySQL MySQL | =5.0.20 | |
MySQL MySQL | =5.0.1 | |
MySQL MySQL | =5.0.4 | |
MySQL MySQL | =5.0.82 | |
MySQL MySQL | =5.0.16 | |
Oracle MySQL | =5.0.51 | |
Oracle MySQL | =5.0.23 | |
Oracle MySQL | =5.0.41 | |
Oracle MySQL | =5.0.45 | |
Oracle MySQL | =5.0.67 | |
Oracle MySQL | =5.0.75 | |
Oracle MySQL | =5.0.77 | |
Oracle MySQL | =5.0.81 | |
Oracle MySQL | =5.0.83 | |
Oracle MySQL | =5.0.85 | |
Oracle MySQL | =5.0.86 | |
Oracle MySQL | =5.0.88 | |
Oracle MySQL | =5.0.89 | |
Oracle MySQL | =5.0.90 | |
Oracle MySQL | =5.0.91 | |
Oracle MySQL | =5.0.92 | |
MySQL MySQL | =5.1.23 | |
MySQL MySQL | =5.1.34 | |
MySQL MySQL | =5.1.37 | |
MySQL MySQL | =5.1.31 | |
MySQL MySQL | =5.1.32 | |
Oracle MySQL | =5.1.39 | |
Oracle MySQL | =5.1.40-sp1 | |
Oracle MySQL | =5.1.40 | |
Oracle MySQL | =5.1.41 | |
Oracle MySQL | =5.1.42 | |
Oracle MySQL | =5.1.43 | |
Oracle MySQL | =5.1.43-sp1 | |
Oracle MySQL | =5.1.44 | |
Oracle MySQL | =5.1.45 | |
Oracle MySQL | =5.1.46-sp1 | |
Oracle MySQL | =5.1.46 | |
Oracle MySQL | =5.1.47 | |
Oracle MySQL | =5.1.48 | |
Oracle MySQL | =5.1.49-sp1 | |
Oracle MySQL | =5.1.49 | |
Oracle MySQL | =5.1 | |
Oracle MySQL | =5.1.1 | |
Oracle MySQL | =5.1.2 | |
Oracle MySQL | =5.1.3 | |
Oracle MySQL | =5.1.4 | |
Oracle MySQL | =5.1.10 | |
Oracle MySQL | =5.1.11 | |
Oracle MySQL | =5.1.12 | |
Oracle MySQL | =5.1.13 | |
Oracle MySQL | =5.1.14 | |
Oracle MySQL | =5.1.15 | |
Oracle MySQL | =5.1.16 | |
Oracle MySQL | =5.1.17 | |
Oracle MySQL | =5.1.18 | |
Oracle MySQL | =5.1.19 | |
Oracle MySQL | =5.1.20 | |
Oracle MySQL | =5.1.21 | |
Oracle MySQL | =5.1.22 | |
Oracle MySQL | =5.1.24 | |
Oracle MySQL | =5.1.25 | |
Oracle MySQL | =5.1.26 | |
Oracle MySQL | =5.1.27 | |
Oracle MySQL | =5.1.28 | |
Oracle MySQL | =5.1.29 | |
Oracle MySQL | =5.1.30 | |
Oracle MySQL | =5.1.33 | |
Oracle MySQL | =5.1.35 | |
Oracle MySQL | =5.1.36 | |
Oracle MySQL | =5.1.38 | |
Oracle MySQL | =5.1.23-a | |
Oracle MySQL | =5.1.31-sp1 | |
Oracle MySQL | =5.1.34-sp1 | |
Oracle MySQL | =5.1.37-sp1 |
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.