Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: LDAP metadata collection err #5683

Merged
merged 1 commit into from
Oct 7, 2024
Merged

Conversation

RamanaReddy0M
Copy link
Contributor

@RamanaReddy0M RamanaReddy0M commented Oct 1, 2024

Test

Local setup

docker-compose.yaml

version: '3.8'

networks:
  openldap-network:
    driver: bridge
services:
  openldap:
    image: bitnami/openldap:latest
    ports:
      - '1389:1389'
      - '1636:1636'
    environment:
      - LDAP_ADMIN_USERNAME=admin
      - LDAP_ADMIN_PASSWORD=adminpassword
      - LDAP_USERS=user01,user02
      - LDAP_PASSWORDS=password1,password2
    networks:
      - openldap-network
    volumes:
      - 'openldap_data:/bitnami/openldap'

volumes:
  openldap_data:
    driver: local
$ docker compose up -d 
Template
id: ldap-default-creds

info:
  name: LDAP Default Credential - Bruteforce
  author: pussycat0x
  severity: info
  description: |
    Attempts to guess username/password combinations over LDAP.
  metadata:
    shodan-query: ldap
  tags: js,network,ldap,enum

javascript:
  - code: |
      const ldap = require('nuclei/ldap');
      const cfg = new ldap.Config();
      cfg.Upgrade = true;
      const client = ldap.Client(Url, Realm, cfg);
      const metadata = client.CollectMetadata();
      log(to_json(metadata))

    args:
      Host: "ldap://{{Host}}"
      Port: 1389
      Url: "ldap://{{Host}}:{{Port}}"
      Realm: "example.org"

    matchers:
      - type: dsl
        dsl:
          - 'success == true'
✗./nuclei -t test.yaml -u localhost -debug

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

                projectdiscovery.io

[INF] Current nuclei version: v3.3.4 (latest)
[INF] Current nuclei-templates version: v10.0.1 (latest)
[WRN] Scan results upload to cloud is disabled.
[INF] New templates added in latest release: 86
[INF] Templates loaded for current scan: 1
[WRN] Loading 1 unsigned templates for scan. Use with caution.
[INF] Targets loaded for current scan: 1
[JS] {
  "BaseDN": "dc=example,dc=org",
  "Domain": "example.org",
  "DefaultNamingContext": "",
  "DomainFunctionality": "",
  "ForestFunctionality": "",
  "DomainControllerFunctionality": "",
  "DnsHostName": ""
}
[DBG] [ldap-default-creds] Dumped Javascript request for localhost:1389:
Variables:
        1. Host => ldap://localhost
        2. Port => 1389
        3. Realm => example.org
        4. Url => ldap://localhost:1389 address=localhost:1389
[DBG]  [ldap-default-creds] Javascript Code:

        const ldap = require('nuclei/ldap');
        const cfg = new ldap.Config();
        cfg.Upgrade = true;
        const client = ldap.Client(Url, Realm, cfg);
        const metadata = client.CollectMetadata();
        log(to_json(metadata))

[DBG] [ldap-default-creds] Dumped Javascript response for localhost:1389:
        1. response => {   "BaseDN": "dc=example .... "",   "DnsHostName": "" }
        2. success => true address=localhost:1389
[ldap-default-creds:dsl-1] [javascript] [info] localhost:1389

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@RamanaReddy0M RamanaReddy0M self-assigned this Oct 1, 2024
@tarunKoyalwar tarunKoyalwar requested review from dwisiswant0 and removed request for tarunKoyalwar October 4, 2024 16:12
@ehsandeep ehsandeep merged commit 7ba5d51 into dev Oct 7, 2024
11 of 12 checks passed
@ehsandeep ehsandeep deleted the issue-5446-fix-ldap-metadata branch October 7, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ldap Module CollectMetadata() - not working.
3 participants