SQLite Ô¶³Ì´úÂëÖ´ÐÐÎó²î£¨CVE-2019-5018£©
Ðû²¼Ê±¼ä 2019-05-1101Åä¾°ÐÎò
02Ó°Ïì¹æÄ£
Îó²îÆ·¼¶£º ¸ßΣ
Ó°Ïì¹æÄ££º SQLite 3.26.0¡¢3.27.0
CVSSÆÀ·Ö£º 8.1
03Îó²îÏêÇé
SQLite 3.26.0µÄ´°¿Úº¯ÊýÖб£´æ¿É±»Ê¹ÓõÄuse-after-freeÎó²î£¬¹¥»÷Õß¿Éͨ¹ý·¢ËͶñÒâSQLÏÂÁîÀ´´¥·¢´ËÎó²î£¬µ¼ÖÂÔ¶³Ì´úÂëÖ´ÐС£
Ïêϸϸ½ÚΪ£¬SQLiteÔÚ¶Ô°üÀ¨´°¿Úº¯ÊýµÄSELECTÓï¾ä¾ÙÐÐÆÊÎöºó£¬Ê¹ÓÃsqlite3WindowRewriteº¯Êý¶Ô¸ÃSELECTÓï¾ä¾ÙÐÐת»»¡£
Ôڴ˺¯ÊýÖУ¬ÈôÊǸÃSELECTÓï¾ä°üÀ¨¾ÛºÏº¯Êý£¨COUNT£¬MAX£¬MIN£¬AVG£¬SUM£©£¬ÔòÖØдSELECT¹¤¾ßÉúÑĵıí´ïʽÁÐ±í£¨ÏÂͼÖеÚ[0]ÐУ©¡£
×¢ÖØÖ÷´°¿Ú¹¤¾ßÔÚWindowRewrite¹¤¾ßÖÐʹÓá£ÔÚÑ»·´¦Öóͷ£Ã¿Ò»¸ö±í´ïʽʱ£¬½«xExprCallbackº¯Êý×÷Ϊ»Øµ÷º¯Êý¡£µ±´¦Öóͷ£¾ÛºÏº¯Êý£¨TK AGG FUNCTION£©ºó£¬±í´ïʽ±»É¾³ý[2]¡£
ÈôÊDZ»É¾³ýµÄ±í´ïʽ±»±ê¼ÇΪ´°¿Úº¯Êý£¬ÔòÒ²»áɾ³ý¹ØÁªµÄWindow¹¤¾ß¡£
²¢É¾³ý¸ÃWindow¹¤¾ß¹ØÁªµÄ·ÖÇø¡£
¿ÉÒÔʹÓÃDebug°æ±¾µÄsqlite3ÏÈÇå¿Õ±»freeµÄ»º³åÇøµÄÄÚÈÝ£¬ÒÔ¸üºÃµØ¾ÙÐÐÑÝʾ[5]¡£
ͨ¹ýgdb sqlite3ÔËÐÐPoC£¬¿ÉÊӲ쵽0xfafafafafafafafaÖÜΧ±¬·¢Í߽⣬ÕâÒâζ×ŶÔÒÑÊͷŵĻº³åÇøµÄÔٴλá¼û£º

04ÐÞ¸´½¨Òé
05²Î¿¼Á´½Ó
https://www.sqlite.org/src/info/884b4b7e502b4e99