generated from Ostorlab/template_agent
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle
json.decoder.JSONDecodeError
exceptions.
- Loading branch information
1 parent
afa90cf
commit 55a9df1
Showing
3 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -769,3 +769,18 @@ def testAgentNuclei_whenDescriptionIsLong_shouldNotTruncate( | |
agent_mock[0].data["description"] | ||
== "The SSH transport protocol with certain OpenSSH extensions, found in OpenSSH before 9.6 and other products, allows remote attackers to bypass integrity checks such that some packets are omitted (from the extension negotiation message), and a client and server may consequently end up with a connection for which some security features have been downgraded or disabled, aka a Terrapin attack. This occurs because the SSH Binary Packet Protocol (BPP), implemented by these extensions, mishandles the handshake phase and mishandles use of sequence numbers. For example, there is an effective attack against SSH's use of ChaCha20-Poly1305 (and CBC with Encrypt-then-MAC). The bypass occurs in [email protected] and (if CBC is used) the [email protected] MAC algorithms. This also affects Maverick Synergy Java SSH API before 3.1.0-SNAPSHOT, Dropbear through 2022.83, Ssh before 5.1.1 in Erlang/OTP, PuTTY before 0.80, AsyncSSH before 2.14.2, golang.org/x/crypto before 0.17.0, libssh before 0.10.6, libssh2 through 1.11.0, Thorn Tech SFTP Gateway before 3.4.6, Tera Term before 5.1, Paramiko before 3.4.0, jsch before 0.2.15, SFTPGo before 2.5.6, Netgate pfSense Plus through 23.09.1, Netgate pfSense CE through 2.7.2, HPN-SSH through 18.2.0, ProFTPD before 1.3.8b (and before 1.3.9rc2), ORYX CycloneSSH before 2.3.4, NetSarang XShell 7 before Build 0144, CrushFTP before 10.6.0, ConnectBot SSH library before 2.2.22, Apache MINA sshd through 2.11.0, sshj through 0.37.0, TinySSH through 20230101, trilead-ssh2 6401, LANCOM LCOS and LANconfig, FileZilla before 3.66.4, Nova before 11.8, PKIX-SSH before 14.4, SecureCRT before 9.4.3, Transmit5 before 5.10.4, Win32-OpenSSH before 9.5.0.0p1-Beta, WinSCP before 6.2.2, Bitvise SSH Server before 9.32, Bitvise SSH Client before 9.33, KiTTY through 0.76.1.13, the net-ssh gem 7.2.0 for Ruby, the mscdex ssh2 module before 1.15.0 for Node.js, the thrussh library before 0.35.1 for Rust, and the Russh crate before 0.40.2 for Rust.\n" | ||
) | ||
|
||
|
||
@mock.patch("agent.agent_nuclei.OUTPUT_PATH", "./tests/invalid_nuclei_result.json") | ||
def testAgentNuclei_whenResultIsInvalidJson_agentShouldHandleExceptionAndDoNotRaise( | ||
scan_message: message.Message, | ||
nuclei_agent_no_url_scope: agent_nuclei.AgentNuclei, | ||
mocker: plugin.MockerFixture, | ||
agent_mock: list[message.Message], | ||
) -> None: | ||
"""Ensure the agent handles `json.decoder.JSONDecodeError` exceptions.""" | ||
mocker.patch("subprocess.run", return_value=None) | ||
|
||
nuclei_agent_no_url_scope.process(scan_message) | ||
|
||
assert len(agent_mock) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"curl-command":"curl -X 'POST' -d '_=<script>alert(1)</script>' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Host: web.com' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2866.71 Safari/537.36' 'https://web.com/'","host":"https://web.com","extracted-results": ["result1"],"info":{"author":["dwisiswant0","lu4nx"],"classification":{"cve-id":null "cvss-metrics":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N","cwe-id":["cwe-200"]},"description":"A web application firewall was detected.","name":"WAF Detection","reference":["https://github.com/ekultek/whatwaf"],"severity":"critical","tags":["waf","tech","misc"]},"ip":"54.183.147.1","matched-at":"https://web.com/","matcher-name":"ats","matcher-status":true,"request":"POST / HTTP/1.1\r\nHost: ","response":"HTTP/1.1 200 OK\r\nConnection: close\r\nCache-Control: no-store, no-cache, ","timestamp":"2022-03-28T19:56:11.826498997Z","type":"http"} |