id: ollama-improper-authorization

info:
  name: Ollama - Improper Authorization
  author: 0x_Akoko
  severity: medium
  description: |
    Detected an exposed Ollama API without proper authorization, allowing unauthorized access to AI models and operations.
  reference:
    - https://ollama.ai/
    - https://github.com/ollama/ollama
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
    cvss-score: 5.3
    cwe-id: CWE-862
  metadata:
    verified: true
    max-request: 1
    shodan-query: http.html:"Ollama" port:11434
    fofa-query: body="Ollama" && port="11434"
  tags: ollama,exposure,misconfig,ai,unauth

http:
  - method: GET
    path:
      - "{{BaseURL}}/api/tags"

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'
          - 'contains(content_type, "application/json")'
          - 'contains_all(body, "models", "modified_at", "digest", "size")'
        condition: and

    extractors:
      - type: json
        name: models
        part: body
        json:
          - '.models[].name'
# digest: 4a0a0047304502207e22ac3d97fb6e852af69dab805b97f12b81e253cd62b2dfad5919431f343903022100ac4e1754b74fa70155511c50db0118813b30a4f3cf1b318b6231d3d09bba7b7e:922c64590222798bb761d5b6d8e72950