CAPEC-27
Leveraging Race Conditions via Symbolic Links
This attack leverages the use of symbolic links (Symlinks) in order to write to sensitive files. An attacker can create a Symlink link to a target file not otherwise accessible to them. When the privileged program tries to create a temporary file with the same name as the Symlink link, it will actually write to the target file pointed to by the attackers' Symlink link. If the attacker can insert malicious content in the temporary file they will be writing to the sensitive file by using the Symlink. The race occurs because the system checks if the temporary file exists, then creates the file. The attacker would typically create the Symlink during the interval between the check and the creation of the temporary file.
Soyutlama
Detailed
Tipik ciddiyet
High
Saldırı ihtimali
Medium
Saldırıyı anla
Bu saldırı kalıbı nedir?
Uygulama akışı
Saldırı adım adım nasıl ilerler?
Explore
Verify that target host's platform supports symbolic links.
Kullanılan teknikler
- Research target platform to determine whether it supports symbolic links.
- Create a symbolic link and ensure that it works as expected on the given platform.
Examine application's file I/O behavior
Kullanılan teknikler
- Use kernel tracing utility such as ktrace to monitor application behavior.
- Use debugging utility such as File Monitor to monitor the application's filesystem I/O calls
- Watch temporary directories to see when temporary files are created, modified and deleted.
- Analyze source code for open-source systems like Linux, Apache, etc.
Experiment
Verify ability to write to filesystem
Kullanılan teknikler
- Create a file that does not exist in the target directory (e.g. "touch temp.txt" in UNIX-like systems)
- On platforms that differentiate between file creation and file modification, if the target file that the application writes to already exists, attempt to modify it.
- Verify permissions on target directory
Exploit
Replace file with a symlink to a sensitive system file.
Kullanılan teknikler
- Create an infinite loop containing commands such as "rm -f tempfile.dat; ln -s /etc/shadow tempfile.dat". Wait for an instance where the following steps occur in the given order: (1) Application ensures that tempfile.dat exists and that the user has access to it, (2) "rm -f tempfile.dat; ln -s /etc/shadow tempfile.dat", and (3) Application opens tempfile.dat for writing, and inadvertently opens /etc/shadow for writing instead.
- Use other techniques with debugging tools to replace the file between the time the application checks the file and the time the application opens it.
Gereksinimler
Saldırının gerçekleşmesi için ne gerekir?
Ön koşullar
- The attacker is able to create Symlink links on the target host.
- Tainted data from the attacker is used and copied to temporary files.
- The target host does insecure temporary file creation.
Gerekli beceri
- Medium: This attack is sophisticated because the attacker has to overcome a few challenges such as creating symlinks on the target host during a precise timing, inserting malicious data in the temporary file and have knowledge about the temporary files created (file name and function which creates them).
Gerekli kaynak
MITRE kaydında belirtilmemiş.
Etki
Başarılı saldırı neye yol açar?
Etkilenen alanlar: Integrity
Etkilenen alanlar: Confidentiality, Access Control, Authorization
Etkilenen alanlar: Availability
Savunma
Nasıl önlenir ve etkisi azaltılır?
Gerçek dünya