Skip to content

Javascript SMB module not detecting correct SMB version #4832

Description

@epicsilence99

Nuclei version:

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v3.1.10

		projectdiscovery.io

Current Behavior:

When I'm scanning using javascript code with the smb protocol supported it's not returning the correct SMB version on the host being scanned. Every single it time it's saying the version is 2.1 I've verified with shodan and nmap that the host is indeed actually running SMBv1, not SMBv2

Expected Behavior:

I would expect it to return the actual SMB version that's running on the target being scanned.

Steps To Reproduce:

Example: steps to reproduce the behavior:

  1. Run nuclei -u https://target_here -t smb-detect-service-version.yaml
  2. Observe results below:
[JS] {
  "SupportV1": false,
  "Version": {
    "Major": 2,
    "Minor": 1,
    "Revision": 0,
    "VerString": "SMB 2.1"
  },
  "NativeOs": "",
  "NTLM": "",
  "GroupName": "",
  "Capabilities": {
    "DFSSupport": true,
    "Leasing": true,
    "LargeMTU": true,
    "MultiChan": false,
    "Persist": false,
    "DirLeasing": false,
    "Encryption": false
  },
  "HasNTLM": true,
  "NegotiationLog": {
    "HeaderLog": {
      "ProtocolID": [
        0,
        0,
        0,
        0,
        254,
        83,
        77,
        66
      ],
      "Status": 0,
      "Command": 0,
      "Credits": 1,
      "Flags": 1
    },
    "ProtocolID": [
      0,
      0,
      0,
      0,
      254,
      83,
      77,
      66
    ],
    "Status": 0,
    "Command": 0,
    "Credits": 1,
    "Flags": 1,
    "SecurityMode": 1,
    "DialectRevision": 528,
    "ServerGuid": [
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      211,
      138,
      30,
      169,
      255,
      137,
      176,
      73,
      183,
      160,
      154,
      52,
      37,
      227,
      149,
      241
    ],
    "Capabilities": 7,
    "SystemTime": 1709586164,
    "ServerStartTime": 1703694346,
    "AuthenticationTypes": [
      "1.3.6.1.4.1.311.2.2.30",
      "1.2.840.48018.1.2.2",
      "1.2.840.113554.1.2.2",
      "1.2.840.113554.1.2.2.3",
      "1.3.6.1.4.1.311.2.2.10"
    ]
  },
  "SessionSetupLog": {
    "HeaderLog": {
      "ProtocolID": [
        0,
        0,
        0,
        0,
        254,
        83,
        77,
        66
      ],
      "Status": 3221225494,
      "Command": 1,
      "Credits": 1,
      "Flags": 1
    },
    "ProtocolID": [
      0,
      0,
      0,
      0,
      254,
      83,
      77,
      66
    ],
    "Status": 3221225494,
    "Command": 1,
    "Credits": 1,
    "Flags": 1,
    "SetupFlags": 0,
    "TargetName": "{obfuscate}",
    "NegotiateFlags": 2726887941
  }
}

Anything else:

Template being used below that got the above response:

id: smb-service-detection-version
info:
  name: Detect SMB Service and Version
  author: inkeep
  severity: info

javascript:
  - code: |
      var smb = require('nuclei/smb');
      var c = smb.SMBClient();
      var metadata = c.ConnectSMBInfoMode(Host, Port);
      log(to_json(metadata));

    args:
      Host: "{{Host}}"
      Port: 445

    extractors:
      - type: json
        json:
          - '.Version.VerString'

Metadata

Metadata

Assignees

Labels

Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions