Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Al 3231 js jaws possible heuristics signatures #732

Merged
merged 9 commits into from
Jun 14, 2024
200 changes: 154 additions & 46 deletions jsjaws.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions signatures/active_x_object.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""
These are all of the signatures related to using ActiveXObjects
"""

from signatures.abstracts import Signature


class ActiveXObject(Signature):
# Supported by https://github.com/target/strelka/blob/3439953e6aa2dafb68ea73c3977da11f87aeacdf/src/python/strelka/scanners/scan_javascript.py#L35
def __init__(self):
super().__init__(
heuristic_id=3,
Expand Down
2 changes: 2 additions & 0 deletions signatures/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

class Unescape(Signature):
# Supported by https://github.com/CYB3RMX/Qu1cksc0pe/blob/ad3105ab9d3363df013ff95bae218f5c374a93fb/Systems/Multiple/malicious_html_codes.json#L27
# Supported by https://github.com/target/strelka/blob/3439953e6aa2dafb68ea73c3977da11f87aeacdf/src/python/strelka/scanners/scan_javascript.py#L33
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/unescape
def __init__(self):
super().__init__(
Expand Down Expand Up @@ -101,6 +102,7 @@ def process_output(self, output):


class CryptoJSObfuscation(Signature):
# Supported by https://github.com/target/strelka/blob/3439953e6aa2dafb68ea73c3977da11f87aeacdf/src/python/strelka/scanners/scan_javascript.py#L41
def __init__(self):
super().__init__(
heuristic_id=3,
Expand Down
18 changes: 18 additions & 0 deletions signatures/network.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""
These are all of the signatures related to making network requests
"""

from signatures.abstracts import ALL, Signature


class PrepareNetworkRequest(Signature):
# Supported by https://github.com/CYB3RMX/Qu1cksc0pe/blob/ad3105ab9d3363df013ff95bae218f5c374a93fb/Systems/Multiple/malicious_html_codes.json#L47
# Supported by https://github.com/target/strelka/blob/3439953e6aa2dafb68ea73c3977da11f87aeacdf/src/python/strelka/scanners/scan_javascript.py#L36
def __init__(self):
super().__init__(
heuristic_id=3,
Expand Down Expand Up @@ -90,3 +92,19 @@ def process_output(self, output):
{"method": ALL, "indicators": self.indicators},
]
self.check_multiple_indicators_in_list(output, indicator_list)


class WebSocketUsage(Signature):
# Inspired by https://github.com/target/strelka/blob/3439953e6aa2dafb68ea73c3977da11f87aeacdf/src/python/strelka/scanners/scan_javascript.py#L40
# https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
def __init__(self):
super().__init__(
heuristic_id=3,
name="websocket_usage",
description="WebSocket object was used for communicating with a server",
indicators=["WebSocket("],
severity=0,
)

def process_output(self, output):
self.check_indicators_in_list(output)
17 changes: 17 additions & 0 deletions signatures/suspicious_function_call.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
These are all of the signatures related to using suspicious function calls
"""

from signatures.abstracts import Signature


Expand Down Expand Up @@ -39,3 +40,19 @@ def __init__(self):

def process_output(self, output):
self.check_indicators_in_list(output, match_all=True)


class ExecCommandUsage(Signature):
# Inspired by https://github.com/target/strelka/blob/3439953e6aa2dafb68ea73c3977da11f87aeacdf/src/python/strelka/scanners/scan_javascript.py#L34
# https://developer.mozilla.org/en-US/docs/Web/API/document/execCommand
def __init__(self):
super().__init__(
heuristic_id=3,
name="execcommand_usage",
description="Executes command, possibly related to clipboard access, or editing forms and documents.",
indicators=["execCommand("],
severity=0,
)

def process_output(self, output):
self.check_indicators_in_list(output, match_all=True)
3 changes: 3 additions & 0 deletions signatures/suspicious_process.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""
These are all of the signatures related to the presence of suspicious processes
"""

from signatures.abstracts import Signature


class SuspiciousProcess(Signature):
# Supported by https://github.com/target/strelka/blob/3439953e6aa2dafb68ea73c3977da11f87aeacdf/src/python/strelka/scanners/scan_javascript.py#L42
def __init__(self):
super().__init__(
heuristic_id=3,
Expand All @@ -20,6 +22,7 @@ def process_output(self, output):

class EvalUsage(Signature):
# Inspired by https://github.com/CYB3RMX/Qu1cksc0pe/blob/ad3105ab9d3363df013ff95bae218f5c374a93fb/Systems/Multiple/malicious_html_codes.json#L7
# Supported by https://github.com/target/strelka/blob/3439953e6aa2dafb68ea73c3977da11f87aeacdf/src/python/strelka/scanners/scan_javascript.py#L31
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval!
def __init__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"heur_id": 25,
"score": 100,
"score_map": {},
"signatures": {}
"signatures": {
"short_form": 1
}
},
"promote_to": null,
"tags": {},
Expand Down Expand Up @@ -986,7 +988,9 @@
{
"attack_ids": [],
"heur_id": 25,
"signatures": []
"signatures": [
"short_form"
]
},
{
"attack_ids": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
"heur_id": 25,
"score": 100,
"score_map": {},
"signatures": {}
"signatures": {
"short_form": 1
}
},
"promote_to": null,
"tags": {},
Expand Down Expand Up @@ -856,7 +858,9 @@
{
"attack_ids": [],
"heur_id": 25,
"signatures": []
"signatures": [
"short_form"
]
},
{
"attack_ids": [],
Expand Down
4 changes: 0 additions & 4 deletions tools/malwarejail/env/web/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -6318,10 +6318,6 @@ URLPattern = function () {
util_log(">>> FIXME: URLPattern used");
return URLPattern;
}
URLSearchParams = function () {
util_log(">>> FIXME: URLSearchParams used");
return URLSearchParams;
}
USB = function () {
util_log(">>> FIXME: USB used");
return USB;
Expand Down
1 change: 1 addition & 0 deletions tools/malwarejail/jailme.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ sandbox.TextDecoder = TextDecoder;
sandbox.TextDecoderStream = TextDecoderStream;
sandbox.TextEncoder = TextEncoder;
sandbox.TextEncoderStream = TextEncoderStream;
sandbox.URLSearchParams = URLSearchParams;

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

Expand Down