当前位置:网站首页>Red team Chapter 10: ColdFusion the difficult process of deserializing WAF to exp to get the target
Red team Chapter 10: ColdFusion the difficult process of deserializing WAF to exp to get the target
2022-07-01 16:20:00 【User 6293454】
Part1 Preface
Hello everyone , Last week I shared 《 Give any java Program hang Socks5 Proxy method 》、《 Blind guess the difficult process of using the upload vulnerability of the package 》 Two red team technical articles , The response was not bad . This issue shares a story about Java Deserialization vulnerability waf Case study . The target application system is Adobe ColdFusion dynamic web The server , The corresponding vulnerability number is CVE-2017-3066, I have used this deserialization vulnerability to get permission many times . The target is directly placed on the public network , Website deployed waf, And this waf Can identify deserialization attack packets , I spent twoorthree days , Bypassing layers of protection , After one level after another , Eventual success getshell, The process is very difficult .
Part2 Technology research process
- The first 1 Pit , Around the waf The first level
Waf First of all, url The attack path of is intercepted , Scan the directory to find a /flex2gateway/amf This file path , At a glance, we know that the probability exists coldfusion Deserialization vulnerability , Actually, it is directly placed under the root directory of the website of the external network target . Don't be happy too early , After testing , Just use POST Request access to this /flex2gateway/amf route , Will be waf Intercept . Description in POST Under request ,waf Identify this path , Encounter this path is considered an attack , So stop it . Next, let's look at the bypass method :
take URL route /flex2gateway/amf Turn into :
http://www.xxx.com//////////////////////////////////////////flex2gateway///////////////////////////////amf
(////// The string is very long , Much longer than the above , In order to avoid taking up too much space , I won't post it completely )
The result is still waf Intercepted . Next, continue to add super large strings , Here's how to do it :
http://www.xxx.com//////////////////////////////////////////flex2gateway///////////////////////////////amf?abc123=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ok, We managed to bypass waf The equipment is right url Path detection .
- The first 2 Pit , Individual scripts will cause the website to crash
For the exploitation of this vulnerability , It used to be cf_blazeds_des.py This script , But you need to pay special attention when using , This script passes sun.rmi.server.UnicastRef Class to realize the utilization of deserialization vulnerability , The premise is that the server must get the network , I recently 2 Encountered in coldfusion Deserialization vulnerability , Can bounce directly out of the net shell The situation is less and less , And at most dns Can out . Then there is a huge pit , Using this script requires doing your homework in advance , One contract is used successfully , Otherwise send a 3、5 Second packet , The application is bound to hang up . therefore , I hardly use this script , Unless you have to .
- The first 3 Pit ,ColdFusionPwn Tool convergence
Next, we need to find ways to exploit this vulnerability without going out of the network , stay github After various searches , Find out ColdFusionPwn This tool looks good , It's also java Written , If I encounter problems, I can change myself . Who knows when you really use this tool , Has been an error , Prompt unable to load main class . It used to work normally , But I can't use it today , I don't know where the problem is .
From the instructions of the tool ,ColdFusionPwn This tool needs to depend on ysoserial This jar package . I simply downloaded the author's java Code , Use Intellij Idea Import to ysoserial in , Change the code flow a little , Now it can be generated normally by itself payload 了 ,-s And -e yes ColdFusionPwn Two different tools payload Generation patterns , To put it bluntly , That is, different methods of vulnerability utilization , It can be used during actual measurement .
- The first 4 Pit , Around the waf The first 2 Turn off
Use the code from the previous step to generate payload after , take payload Import burpsuite Of Repeater In function , Send the packet out , Results found waf Right again post The inclusion is intercepted , Click on “ send out ” Button ,waf Will directly throw away the data packet , Quickly return to empty .
Next, after a series of tests and judgments , Find out waf The equipment will release oversized packets , As shown in the figure below ,waf The device does not intercept .
But this adds dirty data directly in front of the deserialized byte data , Definitely not , Because the deserialization attack code cannot be triggered . Then I remembered my former colleagues “ Memories float like snow ” Of Java Deserialize articles that add dirty data , So I downloaded his java Code , After a toss , Write the author DirtyDataWrapper Class into its own ysoserial Go inside , Realize to ColdFusionPwn The transformation of mixed dirty data of the generated deserialized packet .
The final generated attack code is shown in the figure below :
- The first 5 Pit , too waf The first 3 Turn off
Continue to look at the screenshot above , It was found that WAF Intercepted , I don't know where the problem is . Finally, after a lot of testing and analysis , Discover as long as POST The packet contains java.util.LinkedList Class keyword ,waf The packets will be discarded directly .ε=(´ο`*))) alas , It's so hard . So let's see “ Memories float like snow ” Of java How to write the code , I want to transform it . Finally, I found a simple solution , Put him DirtyDataWrapper Class code type The value is equal to 0, Dirty packets generated in this way , Does not include being waf Intercepted sensitive classes . Specifically, why is it changed like this , There is no narration here , You can start from github Search for relevant codes on , Analyze for yourself .
Finally generated payload, Perfect bypass waf.
- The first 6 Pit ,ysoserial Carry out orders
Next, find a way to get shell、 Take the target , Unfortunately, the server is not offline , There is no direct rebound shell. After testing , Come to the conclusion :TCP Not out of the network , however DNS Can out . So I thought of a way , adopt DNSlog hold web Read the path bit by bit , If a byte is read too slowly , Can combine linux Read the command paragraph by paragraph , And then to this web Write a... Under the path webshell that will do .
But in the end, a new problem came , In the course of actual combat ,URLDNS This use chain can get out of the network , however ping xxx.dnslog.cn I can't get out of the net anyway ... adopt dns Read the operating system name , It is found that the target server is linux. Finally, I built a local coldfusion Environmental Science , After a series of tests , I find the problem is ysoserial Of Gadgets During the command execution of class .
notes , For this test case , I changed the writing of various executive commands , After a lot of experiments , The code must be written as shown in the following figure , To execute the command successfully . For the first time , Other writing methods are not good , The conclusion of practice is like this , It's so hard .
- The first 7 Pit ,dnslog Length limit
You can go through DNSLOG read web Path , Just get it web route , You can write directly shell Got permission , But it turns out dnslog You can't get the path result anyway . Then I figured it out ,DNSlog There is a length limit , It must be the target server web The path is too long . therefore , I've been tested , combination linux Self contained system directory sed And cut, Give the following method of reading the absolute path of the website paragraph by paragraph . ha-ha , Share it with you .
ping `pwd|base64|sed -n '1p'|cut -c 1-60
ping `pwd|base64|sed -n '1p'|cut -c 61-80
It is best to burp Of Collaborator client function , Very easy to use, very stable , If you use dnslog Words , Many times the browser gets stuck ,dnslog Will never see dnslog Information. , You have to change the domain name , Very trouble . There will be all kinds of inexplicable problems in actual combat , Later I got shell after , It is found that the problem is load balancing ...
- The first 8 Pit , Load balancing
write in webshell after , Find out shell I can't get access to , Has it been deleted ? Suddenly I slapped my leg , My day, , This station even has load balancing ! No wonder there are always some inexplicable problems when testing vulnerabilities in the early stage ... So I opened it burpsuite Of intruder function , Will write shell Of payload Hundreds of contracts have been awarded , After the visit webshell The success rate of has been greatly improved ... For load balancing , I have no good solution , add to cookie The method cannot be used .
This case actually encountered more pits than the above , There are many twists and turns , But the time interval is a little long , I can't remember many places , But the key point is the above part , Welcome to make corrections , Send me a message to give advice .
Part3 summary
1. For the exploitation of deserialization vulnerability , Many times you have to exp Make a change , To adapt to various environments .
2. Build more environments , Avoid walking into a dead end .
3. quote “ Memories float like snow ” The article : https://gv7.me/articles/2021/java-deserialize-data-bypass-waf-by-adding-a-lot-of-dirty-data/
边栏推荐
- 程序员职业生涯真的很短吗?
- 从 MLPerf 谈起:如何引领 AI 加速器的下一波浪潮
- Vscode find and replace the data of all files in a folder
- Origin2018安装与使用(整理中)
- Embedded development: five revision control best practices
- There is a difference between u-standard contract and currency standard contract. Will u-standard contract explode
- Go 语言源码级调试器 Delve
- ATSs: automatically select samples to eliminate the difference between anchor based and anchor free object detection methods
- Can't global transactions be used when shardingjdbc is used in seate?
- How to adjust the color of the computer screen and how to change the color of the computer screen
猜你喜欢

Win11如何设置用户权限?Win11设置用户权限的方法

IM即时通讯开发万人群聊消息投递方案

process.env.NODE_ENV

PostgreSQL 存储结构浅析

Principle of motion capture system
![[PHP graduation design] design and implementation of textbook management system based on php+mysql+apache (graduation thesis + program source code) -- textbook management system](/img/04/11f24f12c52fb1f69e3d6f513d896b.png)
[PHP graduation design] design and implementation of textbook management system based on php+mysql+apache (graduation thesis + program source code) -- textbook management system

【Hot100】19. Delete the penultimate node of the linked list

There will be a gap bug when the search box and button are zoomed

Thinkphp内核工单系统源码商业开源版 多用户+多客服+短信+邮件通知

The supply of chips has turned to excess, and the daily output of Chinese chips has increased to 1billion, which will make it more difficult for foreign chips
随机推荐
用手机在同花顺上开户靠谱吗?这样有没有什么安全隐患
德国iF多项大奖加冕,这副耳机有多强?音珀GTW 270 Hybrid深度评测
picgo快捷键 绝了这人和我的想法 一模一样
红队第10篇:coldfusion反序列化过waf改exp拿靶标的艰难过程
投稿开奖丨轻量应用服务器征文活动(5月)奖励公布
How to adjust the color of the computer screen and how to change the color of the computer screen
周少剑,很少见
SQLServer查询: a.id与b.id相同时,a.id对应的a.p在b.id对应的b.p里找不到的话,就显示出这个a.id和a.p
Solution to the problem that the keypad light does not light up when starting up
使用腾讯云搭建图床服务
Stonedb is building blocks for domestic databases, and the integrated real-time HTAP database based on MySQL is officially open source!
苹果自研基带芯片再次失败,说明了华为海思的技术领先性
Guide for high-end programmers to fish at work
Origin2018安装与使用(整理中)
Can't global transactions be used when shardingjdbc is used in seate?
Zero copy technology of MySQL
What is the digital transformation of manufacturing industry
Do280 management application deployment - pod scheduling control
laravel的模型删除后动作
AVL balanced binary search tree