diff --git a/javascript/detection/samba-detect.yaml b/javascript/detection/samba-detect.yaml new file mode 100644 index 0000000000..cc3803783f --- /dev/null +++ b/javascript/detection/samba-detect.yaml @@ -0,0 +1,41 @@ +id: samba-detect + +info: + name: Samba - Detection + author: pussycat0x + severity: info + description: | + Samba allows file and print sharing between computers running Microsoft Windows and computers running Unix. It is an implementation of dozens of services and a dozen protocols, including: NetBIOS over TCP/IP (NBT) SMB (known as CIFS in some versions) + metadata: + max-request: 1 + shodan-query: "port:445" + tags: js,network,samba,detect,linux + +javascript: + - code: | + let m = require("nuclei/smb"); + let c = new m.SMBClient(); + let response = c.ConnectSMBInfoMode(Host, Port); + + const conditionsMet = (response.SupportV1 === true && response.Version.VerString === "SMB 1.0"); + + if (conditionsMet) { + + if (response.NTLM === "") { + printedValue = "Samba detected"; + } else { + printedValue = response.NTLM; + } + } + else { + process.exit(1); + } + + args: + Host: "{{Host}}" + Port: 445 + + extractors: + - type: dsl + dsl: + - response \ No newline at end of file diff --git a/network/detection/samba-detect.yaml b/network/detection/samba-detect.yaml deleted file mode 100644 index c830550edc..0000000000 --- a/network/detection/samba-detect.yaml +++ /dev/null @@ -1,35 +0,0 @@ -id: samba-detect - -info: - name: Samba Service Detection - author: pussycat0x - severity: info - description: Samba is a free and open-source software that allows files to be shared across Windows and Linux systems simply and easily. - reference: - - https://www.samba.org/samba/what_is_samba.html - - https://www.samba.org/samba/history/security.html - remediation: Always apply the latest security patch. - classification: - cwe-id: CWE-200 - metadata: - max-request: 1 - tags: network,smb,samba,detect - -tcp: - - inputs: - - data: 000000a4ff534d4272000000000801400000000000000000000000000000400600000100008100025043204e4554574f524b2050524f4752414d20312e3000024d4943524f534f4654204e4554574f524b5320312e303300024d4943524f534f4654204e4554574f524b5320332e3000024c414e4d414e312e3000024c4d312e3258303032000253616d626100024e54204c414e4d414e20312e3000024e54204c4d20302e313200 - type: hex - host: - - "{{Hostname}}" - port: 139 - matchers-condition: and - matchers: - - type: word - words: - - "SMBr" - - - type: word - words: - - "HTTP/1.1" - negative: true -# digest: 490a0046304402205c153fbf52a7b2dfadb408469629086b32e13a3223444116b3e82f4d762044d2022007d379537a766d3cd6913722a0ef27530f0b94fe88229c24efb1786afd25b1fb:922c64590222798bb761d5b6d8e72950 \ No newline at end of file diff --git a/network/detection/smb-detect.yaml b/network/detection/smb-detect.yaml deleted file mode 100644 index 7aa8736bb6..0000000000 --- a/network/detection/smb-detect.yaml +++ /dev/null @@ -1,28 +0,0 @@ -id: smb-detect - -info: - name: SMB Detection - author: pussycat0x - severity: low - description: | - SMB (Server Message Block) is a network-layered protocol mainly used on Windows for sharing files, printers, and communication between network-attached computers. SMB related vulnerabilities can be levaraged to compromise large-scale systems. - metadata: - max-request: 1 - tags: network,windows,smb,service,detect - -tcp: - - inputs: - - data: 00000031ff534d4272000000001845680000000000000000000000000000be2200000100000e00024e54204c4d20302e3132000200 - type: hex - - host: - - "{{Hostname}}" - port: 445 - - matchers: - - type: word - words: - - "SMBr" - - "NT LM" - condition: and -# digest: 490a00463044022045d1bbb8f1640bc13ccc108187f76a13884be166a254865218059d30b900523602205a53dcdc0271170b73443138c4adb5e299726b6fb7bfb7bd394140c1947ff136:922c64590222798bb761d5b6d8e72950 \ No newline at end of file