id: yourls-detect

info:
  name: YOURLS - Detection
  author: lstatro
  severity: info
  description: |
    Detects if the target is running a YOURLS (Your Own URL Shortener) server
  reference:
    - https://github.com/YOURLS/YOURLS
  classification:
    cpe: cpe:2.3:a:yourls:yourls:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 1
    vendor: yourls
    product: yourls
    shodan-query: title:"Your Own URL Shortener"
    fofa-query: title="Your Own URL Shortener"
  tags: tech,yourls,discovery

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

    redirects: true
    max-redirects: 3

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - '<title>YOURLS'
          - 'content="YOURLS'
          - 'alt="YOURLS'
          - '/yourls-logo'
        condition: or

      - type: status
        status:
          - 200

    extractors:
      - type: regex
        part: body
        group: 1
        regex:
          - 'YOURLS<\/a>([ a-z0-9.-]+)'
          - 'content="YOURLS([ 0-9.]+)"'
# digest: 4a0a00473045022100e0287541cdc4e7ff3f10a75b508cd8ea5ce60e233e6ac1f31ae31613eb436ab60220421e6bdf28212631f8f513b1b667b4098fb2b465f9acf45e090f64bb8cf369bf:922c64590222798bb761d5b6d8e72950