TL;DR
The seffaflik.Kimlik() function creates identity files with world-readable/writable permissions (0777) and is vulnerable to symlink attacks. An attacker can pre-create ~/.seffaflik/.kimlik as a symlink to overwrite arbitrary files, while overly permissive defaults expose sensitive identity data to other local users.
Summary
A local vulnerability in the seffaflik Python package (<= 0.0.9) allows arbitrary file overwrite through a symlink attack during identity file creation in the seffaflik.Kimlik() function. In addition, insecure default permissions expose sensitive identity data to other local users. This issue corresponds to CWE-276: Incorrect Default Permissions and can lead to both information disclosure and denial of service.
Affected Component
seffaflik.Kimlik()function (identity file creation logic)
Affected Versions
seffaflik <= 0.0.9
Vulnerability Classification
- CWE-276: Incorrect Default Permissions
- CWE-59: Improper Link Resolution Before File Access ('Link Following')
Vulnerability Types
- Arbitrary File Overwrite via Symlink
- World-readable / world-writable secret file
- Insecure default file and directory permissions
Impact
Information Disclosure
The identity file ~/.seffaflik/.kimlik is created with permission mode 0777, and the parent directory ~/.seffaflik with 0775. These overly permissive settings allow other local users on the same system to read or modify sensitive identity-related data.
Arbitrary File Overwrite
A local attacker can pre-create a symlink at the identity file path, causing the application to overwrite arbitrary files writable by the victim user when seffaflik.Kimlik() is executed.
Potential Consequences
- Confidentiality: Exposure of sensitive identity data to unauthorized local users
- Integrity: Modification or corruption of arbitrary files via symlink attack
- Availability: Denial of service through overwriting critical system or application files
Attack Vector
A local attacker can pre-create the path ~/.seffaflik/.kimlik as a symbolic link pointing to an arbitrary target file. When the victim executes seffaflik.Kimlik(), the function follows the symlink and overwrites the referenced file. Because no validation or symlink protection is in place, the write operation is performed on the attacker-controlled target. The insecure permission modes further amplify the impact by exposing secrets to other local users.
Prerequisites
- Local access to the target system
- Ability to create files in the victim's home directory or access to shared temporary directories
- Victim must execute code that calls
seffaflik.Kimlik()
Proof of Concept
Step 1: Attacker Creates Malicious Symlink
# Attacker creates the directory structure
mkdir -p ~/.seffaflik
# Create a symlink pointing to a target file (.bashrc)
ln -s ~/.bashrc ~/.seffaflik/.kimlikStep 2: Victim Executes seffaflik.Kimlik()
from seffaflik import Kimlik
# When victim runs this, it follows the symlink and overwrites .bashrc
identity = Kimlik()Step 3: Verify File Overwrite
# The target file (.bashrc) has been overwritten with identity data
cat ~/.bashrcStep 4: Verify Insecure Permissions
# Check permissions on the identity directory and file
ls -la ~/.seffaflik/
# Expected output shows world-readable/writable permissions:
# drwxrwxr-x (0775) for directory
# -rwxrwxrwx (0777) for .kimlik fileRoot Cause Analysis
The vulnerability stems from three fundamental issues:
-
No Symlink Validation: The identity file creation logic does not check whether
~/.seffaflik/.kimlikis a symbolic link before writing to it. -
Insecure Default Permissions: Files and directories are created with overly permissive modes (0777 for files, 0775 for directories), allowing unauthorized access by other local users.
-
Lack of Atomic Operations: The code does not use secure, atomic file creation mechanisms (e.g.,
os.O_CREAT | os.O_EXCL) that would prevent race conditions and symlink attacks.
Recommended Mitigations
For Developers
- Use Secure File Creation:
import os
# Open file with O_CREAT | O_EXCL to prevent symlink attacks
fd = os.open(filepath, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o600)
with os.fdopen(fd, 'w') as f:
f.write(identity_data)- Set Restrictive Permissions:
# Directory: 0700 (rwx------)
os.makedirs(directory, mode=0o700, exist_ok=True)
# File: 0600 (rw-------)
os.chmod(filepath, 0o600)- Validate File Paths:
# Check if path is a symlink before writing
if os.path.islink(filepath):
raise SecurityError("Refusing to write to symlink")For Users
- Update to a patched version of
seffaflikwhen available - Review and restrict permissions on
~/.seffaflik/directory:
chmod 700 ~/.seffaflik
chmod 600 ~/.seffaflik/.kimlik- Monitor for unexpected symlinks in your home directory
References
- CVE Record (CVE-2025-61035)
- PyPI Project: seffaflik
- Source Repository
- CWE-276: Incorrect Default Permissions
- CWE-59: Improper Link Resolution Before File Access
Disclosure Timeline
- 2025-09-01 – Vulnerability discovered
- 2025-10-22 – CVE-2025-61035 published