lists.openwall.net   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  linux-cve-announce  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]
Message-ID: <CAGUWgD9YaRJjKktdArX5J=vY36Zv-NqSxvDxvXOK27HAEdvoyw@mail.gmail.com>
Date: Sat, 24 Jul 2021 18:35:34 +0300
From: Georgi Guninski <gguninski@...il.com>
To: fulldisclosure@...lists.org
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/a.py
try:  import joro2
except:  print("error in import (2)")
root@...lokote:~# cat /tmp/joro2.py
print("in joro 2")
blah=0
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/a.py
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
root@...lokote:~#

_______________________________________________
Sent through the Full Disclosure mailing list
https://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: http://seclists.org/fulldisclosure/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ