id: obsolete-ssh-version

info:
  name: Obsolete and less secure SSH Version
  author: pussycat0x
  severity: info
  reference:
    - https://nmap.org/nsedoc/scripts/sshv1.html
  metadata:
    max-request: 2
    shodan-query: port:22
  tags: enum,js,ssh,network,discovery

javascript:
  - pre-condition: |
      isPortOpen(Host,Port)
    code: |
      var m = require("nuclei/ssh");
      var c = m.SSHClient();
      var response = c.ConnectSSHInfoMode(Host, Port);
      Export(response);

    args:
      Host: "{{Host}}"
      Port: "22"

    matchers:
      - type: dsl
        dsl:
          - "success == true"
          - "version == '1.0'"
        condition: and

    extractors:
      - type: json
        name: SSH Protocol Version
        json:
          - '.ServerID.ProtoVersion'

      - type: json
        internal: true
        name: version
        json:
          - '.ServerID.ProtoVersion'
# digest: 4a0a004730450220062952b5c0a8b1435d83bc9cbf907781497c7d3a941b15963ad0c7876605dd58022100f7abaa4aad4c2724ff99055153f57b893a719aa11db639ad2d54404e46ee7687:922c64590222798bb761d5b6d8e72950