Casdoor IAM platform contains a path traversal flaw allowing authenticated users to write…
Casdoor IAM platform contains a path traversal flaw allowing authenticated users to write arbitrary files outside intended storage directories.
Casdoor, an open-source identity and access management platform, is vulnerable to arbitrary file write attacks through its Local File System storage provider. The vulnerability stems from insufficient sanitization of the pathPrefix parameter in the /api/upload-resource endpoint, allowing authenticated attackers with file upload permissions to use directory traversal sequences (e.g., ../../) to escape the intended $CASDOOR/files/ storage directory. The application fails to validate that destination paths remain within the designated sandbox, enabling attackers to create or overwrite any file accessible to the Casdoor process.
Successful exploitation can lead to severe consequences including overwriting the Casdoor backend database (casdoor.db) causing complete authentication service failure, establishing persistence through scheduled tasks or cron jobs, and potentially achieving full host compromise depending on the privileges of the Casdoor service account. The attack requires an authenticated session with file upload and storage provider management permissions. A patch has been submitted via GitHub pull request #5458, and administrators are advised to restrict use of the Local File System provider in multi-user environments and limit filesystem permissions for the Casdoor service account.
Mentioned in this report
Detection guidance
Path Traversal Attempt Against Casdoor upload-resource Endpoint
Detects directory traversal sequences in the pathPrefix/query parameters targeting Casdoor's /api/upload-resource endpoint, indicating an attempt to write files outside the intended storage directory. Auto-generated starting point — validate and tune in your environment before deploying. IOC matches can false-positive on shared infrastructure and decay as adversary infrastructure rotates.
title: Path Traversal Attempt Against Casdoor upload-resource Endpoint
id: a1295367-9d84-542e-a51e-e4adf4f98245
status: experimental
description: Detects directory traversal sequences in requests to the Casdoor upload-resource
API, which can be abused to write arbitrary files outside the storage sandbox (e.g.
overwriting casdoor.db).
references:
- https://github.com/casdoor/casdoor/pull/5458
logsource:
category: proxy
product: null
detection:
selection:
cs-uri-stem|contains: /api/upload-resource
traversal:
cs-uri-query|contains:
- ../
- ..\\
- '%2e%2e%2f'
- '%2e%2e/'
- ..%2f
condition: selection and traversal
falsepositives:
- Legitimate file uploads that happen to include encoded characters resembling traversal
sequences
- Security scanning/pentest traffic against the Casdoor instance
level: high
tags:
- attack.t1565.001
- attack.t1078
author: Vorant
Suspicious File Write Outside Storage Directory by Casdoor Process
Detects the Casdoor process writing or creating files with path traversal sequences or outside its expected files/ storage directory, consistent with exploitation of the upload-resource path traversal flaw. Auto-generated starting point — validate and tune in your environment before deploying. IOC matches can false-positive on shared infrastructure and decay as adversary infrastructure rotates.
title: Suspicious File Write Outside Storage Directory by Casdoor Process
id: ba6f426b-4e62-510f-9ca9-cd12f7f4bbc7
status: experimental
description: Detects file creation events by the Casdoor process where the target
path contains directory traversal sequences, indicating an attempt to write files
outside the intended $CASDOOR/files/ sandbox (e.g. overwriting casdoor.db or dropping
persistence files).
references:
- https://github.com/casdoor/casdoor/pull/5458
logsource:
category: file_event
product: linux
detection:
selection:
Image|contains: casdoor
traversal:
TargetFilename|contains:
- ../
- ..\\
sensitive_target:
TargetFilename|contains:
- casdoor.db
- /etc/cron
- /var/spool/cron
- crontab
condition: selection and (traversal or sensitive_target)
falsepositives:
- Legitimate Casdoor administration tasks that manipulate configuration or database
files directly on disk
- Backup or migration scripts that copy casdoor.db within expected maintenance windows
level: high
tags:
- attack.t1565.001
- attack.t1078
author: Vorant
Cron or Scheduled Task Creation Spawned by Casdoor Service Process
Detects creation of cron jobs or scheduled tasks by a process tree rooted in the Casdoor service, which may indicate persistence established after exploiting the arbitrary file write vulnerability. Auto-generated starting point — validate and tune in your environment before deploying. IOC matches can false-positive on shared infrastructure and decay as adversary infrastructure rotates.
title: Cron or Scheduled Task Creation Spawned by Casdoor Service Process
id: cd6939d1-dc01-5137-ae0a-a8b6cafdb5bf
status: experimental
description: Detects child processes related to scheduled task or cron job creation
(crontab, at, schtasks) spawned by or shortly after activity from the Casdoor process,
suggesting persistence set up following exploitation of the upload-resource path
traversal vulnerability.
references:
- https://github.com/casdoor/casdoor/pull/5458
logsource:
category: process_creation
product: linux
detection:
selection_parent:
ParentImage|contains: casdoor
selection_cmd:
Image|endswith:
- /crontab
- /at
CommandLine|contains:
- crontab
- /etc/cron
- /var/spool/cron
condition: selection_parent and selection_cmd
falsepositives:
- Administrators legitimately scheduling maintenance tasks from a shell spawned under
the Casdoor service account
- Configuration management tools that manage cron entries via the same service account
level: medium
tags:
- attack.t1053
- attack.t1078
author: Vorant
Behavioural rules are generated from public reporting — validate in your environment before deploying.
Source reporting: https://kb.cert.org/vuls/id/937808
This is the public brief
Subscribers see the full picture: extracted IOCs, ready-to-deploy detections (Sigma, Splunk, KQL, Elastic, YARA, Suricata), the entity graph, TAXII 2.1 feed and real-time alerts matched to your sectors.
Start free