lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date: Sat, 24 Jul 2021 18:35:34 +0300
From: Georgi Guninski <>
Subject: [FD] Potential symlink attack in python3 __pycache__

Potential symlink attack in python3 __pycache__

Not sure if this is vulnerability, but it looks like
classical symlink attack.

In python3, if a script in directory DIR1 does "import another",
then python3 creates directory __pycache__ in DIR1 and puts
some files in __pycache__.

According to our tests, if DIR1/__pycache__ is symlink to something,
then python3 follows the symlink.

We suspect the attacker has little to no control on the created files,
except that the files are created.

Here is an artificial session of root shooting herself in the leg
on ubuntu 20:

root@...lokote:~# python3 --version
Python 3.8.10
root@...lokote:~# cat /tmp/
try:  import joro2
except:  print("error in import (2)")
root@...lokote:~# cat /tmp/
print("in joro 2")
root@...lokote:~# rm ~/tests/*
root@...lokote:~# rm /tmp/__pycache__ #XXX
root@...lokote:~# ls -l ~/tests
total 0
root@...lokote:~# ln -s ~/tests/ /tmp/__pycache__ #XXX shooting in leg
root@...lokote:~# python3 /tmp/
in joro 2
root@...lokote:~# ls -l ~/tests
total 4
-rw-r--r-- 1 root root 144 Jul 24 16:58 joro2.cpython-38.pyc

Sent through the Full Disclosure mailing list
Web Archives & RSS:

Powered by blists - more mailing lists