2023-11-12 19:20:10 +00:00
id : ssh-weak-public-key
info :
name : SSH Host Keys < 2048 Bits Considered Weak
author : pussycat0x
severity : low
description : |
SSH host keys with a bit length below 2048 are deemed weak, posing an increased vulnerability to security threats. Employing robust key lengths is crucial for fortifying the integrity of encrypted communication and thwarting potential exploits.
reference :
- https://www.tenable.com/plugins/nessus/153954
metadata :
verified : true
shodan-query : product:"OpenSSH"
tags : javascript,ssh,misconfig,network
variables :
2023-11-13 09:55:40 +00:00
ecdsa_bit : '256' # 256 bytes = 2048 bits
rsa_bit : '2048' # 2048 bits
2023-11-12 19:20:10 +00:00
javascript :
- code : |
let m = require("nuclei/ssh");
let c = m.SSHClient();
let response = c.ConnectSSHInfoMode(Host, Port);
2023-11-13 09:55:40 +00:00
to_json(response);
2023-11-12 19:20:10 +00:00
args :
Host : "{{Host}}"
Port : "22"
matchers-condition : and
matchers :
- type : word
words :
- "server_host_key"
- type : dsl
dsl :
2023-11-13 09:55:40 +00:00
- 'len(ecdsa_keylen) != 0 && ecdsa_keylen < ecdsa_bit'
- 'len(rsa_keylen) !=0 && rsa_keylen < rsa_bit'
2023-11-12 19:20:10 +00:00
extractors :
- type : json
internal : true
2023-11-13 09:55:40 +00:00
name : ecdsa_keylen
2023-11-12 19:20:10 +00:00
json :
- '.DHKeyExchange.server_host_key.ecdsa_public_key.length'
2023-11-13 09:55:40 +00:00
- type : json
internal : true
name : rsa_keylen
json :
- '.DHKeyExchange.server_host_key.rsa_public_key.length'
2023-11-14 16:28:34 +00:00
# digest: 4b0a00483046022100872fb191406b4167ab389b6ddbecfd8c1645244dbf3f3c82fa0970baf43fa80a022100e3ef573aaa2c1b72cbbec1008123d32cde353f4fe28be3c863e72465687b2494:922c64590222798bb761d5b6d8e72950