Files
sigma-rules/rta/rundll32_javascript_callback.py
T

49 lines
1.3 KiB
Python
Raw Normal View History

2020-06-29 23:07:16 -06:00
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2021-03-03 22:12:11 -09:00
# or more contributor license agreements. Licensed under the Elastic License
# 2.0; you may not use this file except in compliance with the Elastic License
# 2.0.
2020-06-29 23:07:16 -06:00
# Name: RunDLL32 Javascript Callback
# RTA: rundll32_javascript_callback.py
# signal.rule.name: Local Service Commands
# signal.rule.name: Potential Modification of Accessibility Binaries
2020-06-29 23:07:16 -06:00
# ATT&CK: T1085
# Description: Executes javascript code with an AJAX call via RunDll32.exe
from . import common
2022-09-08 12:50:39 -04:00
from . import RtaMetadata
2020-06-29 23:07:16 -06:00
metadata = RtaMetadata(
uuid="75687622-2e75-4612-b213-a31f923efdd4",
platforms=["windows"],
endpoint=[],
siem=[],
techniques=[]
)
2022-09-08 12:50:39 -04:00
2023-10-03 10:47:58 -04:00
@common.requires_os(*metadata.platforms)
2020-06-29 23:07:16 -06:00
def main():
common.log("RunDLL32 with Javascript Callback")
server, ip, port = common.serve_web()
common.clear_web_cache()
url = "http://%s:%d" % (ip, port)
2022-09-08 12:50:39 -04:00
rundll32 = "rundll32.exe"
2020-06-29 23:07:16 -06:00
js = """
'javascript:"\..\mshtml,RunHTMLApplication ";'
'var%20xhr=new%20ActiveXObject("Msxml2.XMLHttp.6.0");,'
'xhr.open("GET", "{url}",false);xhr.send();'
2022-09-08 12:50:39 -04:00
""".format(
url=url
)
packed_js = "".join(s.strip() for s in js.splitlines())
2020-06-29 23:07:16 -06:00
common.execute([rundll32, packed_js])
server.shutdown()
if __name__ == "__main__":
exit(main())