Describe the bug
The upgrade mechanism communicates between versions by writing Python .py files (upgraded_from.py, upgraded_to.py) containing dict/string literals to disk, then immediately importing them. This is executed Python code by design — an attacker who can write to the app directory can inject arbitrary code that runs with the application's privileges.
The EXE_DIR is often on a USB drive (since BusKill is designed to run from a USB kill cord), making physical write access a realistic threat scenario.
Code reference
src/packages/buskill/__init__.py:782-783,832-833:
from upgraded_from import UPGRADED_FROM
...
from upgraded_to import UPGRADED_TO
src/packages/buskill/__init__.py:2198-2206:
with open( os.path.join( new_version_exe_dir, 'upgraded_from.py' ), 'w' ) as fd:
fd.write( 'UPGRADED_FROM = ' +str(contents) )
...
with open( os.path.join( self.EXE_DIR, 'upgraded_to.py' ), 'w' ) as fd:
fd.write( 'UPGRADED_TO = ' +str(self.UPGRADED_TO) )
Expected behavior
Use a safe serialization format like json or configparser instead of writing and importing Python source files. For example:
# Write
import json
with open(path, 'w') as f:
json.dump({'UPGRADED_FROM': contents}, f)
# Read
with open(path) as f:
data = json.load(f)
UPGRADED_FROM = data['UPGRADED_FROM']
Severity
High — arbitrary code execution via crafted .py files on the USB drive.
Describe the bug
The upgrade mechanism communicates between versions by writing Python
.pyfiles (upgraded_from.py,upgraded_to.py) containing dict/string literals to disk, then immediatelyimporting them. This is executed Python code by design — an attacker who can write to the app directory can inject arbitrary code that runs with the application's privileges.The
EXE_DIRis often on a USB drive (since BusKill is designed to run from a USB kill cord), making physical write access a realistic threat scenario.Code reference
src/packages/buskill/__init__.py:782-783,832-833:src/packages/buskill/__init__.py:2198-2206:Expected behavior
Use a safe serialization format like
jsonorconfigparserinstead of writing and importing Python source files. For example:Severity
High — arbitrary code execution via crafted
.pyfiles on the USB drive.