当前位置:网站首页>Research on the security of ognl and El expressions and memory horse
Research on the security of ognl and El expressions and memory horse
2022-07-02 04:24:00 【Domestic giant panda】
First, we study the security of expression engine , Mainly through comparison st2 Of ognl Expression injection and el Expression injection , Let's take a look at the present java Some situations of safety .
1)ognl expression
ognl The expression injection vulnerability mainly lies in st2 On this development framework , Let's first look at the official vulnerability address
https://cwiki.apache.org/confluence/display/WW/Security+Bulletins
remove dos Loophole 、jackson and xstream Loophole 、xss Loophole , The rest is ognl expression rce 了
Then we can read the following article carefully , Security giants have analyzed one by one ognl The mechanism of the vulnerability , Gives a complete summary .
https://www.anquanke.com/post/id/169735
2)el expression
el Expressions are divided into :SimpleEvaluationContext and StandardEvaluationContext, among SimpleEvaluationContext By default, it's safe
2.1) The following link is CVE-2022-22947 Spring Cloud Gateway Fix for expression injection
https://github.com/spring-cloud/spring-cloud-gateway/commit/337cef276bfd8c59fb421bfe7377a9e19c68fe1e
2.2) The following link is CVE-2022-22963 Spring Cloud Function Fix for expression injection
Through the above two examples, we can cure , Where business permits, use SimpleEvaluationContext instead of StandardEvaluationContext perform el expression
2.3) The link below shows ,CVE-2022-22980 spring-data-mongodb Instead of simply using SimpleEvaluationContext
3) Through the above content, we can get a concept , Expression injection is actually much like script injection . In order to increase business efficiency and flexibility, the system can execute any dynamic expression submitted externally , But directly execute external expressions that are not filtered or not strictly filtered , It will lead to safety risks . But when we search for the right el When filtering data of expressions , It is found that we can only search some usage information , Can't find knowledge about security filtering . So we can only summarize by ourselves :
By analyzing the expressions injected into the memory horse , Filtering single quotation marks is a better filtering logic at present
meanwhile spring-data-mongodb The patch of is also implemented in this way
4) To sum up further , The injection of memory horse can depend on :
4.1.1)jndi Inject , In the high version java Remote is not allowed by default in jndi Inject
4.1.2)el expression 、ognl expression
4.1.3)webshell
4.1.4)agent Inject
webshell and agent Involving hard disk writing , This is related to host security products , In this article, we will not analyze . The rest is to focus on the expression engine .
So let's discuss this step , The best way is to use rasp Technical monitoring el Expression and ognl The execution content of the expression , Once the expression length exceeds the threshold, such as 100, be rasp The current expression should be reported and performed once jvm Safety analysis of the whole process .
4.2) The scope of security analysis should include common memory horse related classes
4.2.1)Servlet,Filter,Listener,Tomcat Value Pipe,Spring Controller,Spring Interceptor
( Refer to this article :https://mp.weixin.qq.com/s/HODFJF3NJmsDW2Lcd-ebIg)
4.2.2) The above classes should use hsdb Technology for analysis , prevent agent The injected bytecode is not captured
Refer to this article :https://my.oschina.net/9199771/blog/5529686
4.3) The security analysis should judge whether the common memory horse related classes are abnormal
The system should cache the information of all memory horse related classes after startup , stay jvm During the security analysis of the whole process, the information is used to judge whether the memory horse related classes meet the following conditions :
4.3.1) Related classes exist in memory but not in hard disk
4.3.2) The system adds related classes that do not exist after startup
4.3.3) The bytecode of related classes is inconsistent with that after startup
4.3.4)ast Analyze classes with exceptions
5) adopt source->sink The theory of , We should monitor the behavior function triggered by external input , Yes jvm Targeted verification of integrity , Timely conduct safety audit on the memory horse . If we look at the memory horse problem more extensively 、 Compare upload and write jsp、jspx Of webshell act , We can draw a conclusion :
5.1) Hard disk webshell and agent The horse destroyed the hard disk data 、 Tampered with the application logic , It destroys the logical integrity of the original application ( It is recommended to use tamper proof products for security protection )
5.2) Memory horse destroys the logical integrity of application memory ( It is suggested to pass rasp Product protection )
Finally, thank dada for its technical support
Prohibited reproduced
边栏推荐
- How muddy is the water in the medical beauty industry with a market scale of 100 billion?
- How much is the tuition fee of SCM training class? How long is the study time?
- Use of go package
- [C language] Dynamic Planning --- from entry to standing up
- "No war on the Western Front" we just began to love life, but we had to shoot at everything
- Pytorch---使用Pytorch进行图像定位
- The confusion I encountered when learning stm32
- Thinkphp Kernel wo system source Commercial Open source multi - user + multi - Customer Service + SMS + email notification
- Pytoch --- use pytoch to predict birds
- C language practice - binary search (half search)
猜你喜欢
The core idea of performance optimization, dry goods sharing
cs架构下抓包的几种方法
社交媒体搜索引擎优化及其重要性
A summary of common interview questions in 2022, including 25 technology stacks, has helped me successfully get an offer from Tencent
Introduction to vmware workstation and vSphere
Read "the way to clean code" - function names should express their behavior
Li Kou interview question 02.08 Loop detection
How much is the tuition fee of SCM training class? How long is the study time?
First acquaintance with P4 language
Hand tear - sort
随机推荐
66.qt quick-qml自定义日历组件(支持竖屏和横屏)
6月书讯 | 9本新书上市,阵容强大,闭眼入!
[source code analysis] NVIDIA hugectr, GPU version parameter server - (1)
Play with concurrency: what's the use of interruptedexception?
There is no prompt for SQL in idea XML, and the dialect setting is useless.
深圳打造全球“鸿蒙欧拉之城”将加快培育生态,优秀项目最高资助 1000 万元
Yolov5网络修改教程(将backbone修改为EfficientNet、MobileNet3、RegNet等)
Force buckle 540 A single element in an ordered array
okcc为什么云呼叫中心比传统呼叫中心更好?
Pytoch --- use pytoch to realize u-net semantic segmentation
How much is the tuition fee of SCM training class? How long is the study time?
二叉树解题(二)
Sorted out an ECS summer money saving secret, this time @ old users come and take it away
Pytoch --- use pytoch to predict birds
如何解决在editor模式下 无法删除物体的问题
60后关机程序
[improvement class] st table to solve the interval maximum value problem [2]
The difference between vectorresize and reverse.
Www2022 | know your way back: self training method of graph neural network under distribution and migration
uni-app - 实现获取手机验证码倒计时 60 秒(手机号+验证码登录功能)