New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access violation - pyc file #67470
Comments
(950.e58): Access violation - code c0000005 (first chance) |
You attached a corrupt bytecode cache for stdlib bisect.py: >>> f = open('test.pyc', 'rb')
>>> magic,tstamp = struct.unpack('<ll', f.read(8))
>>> magic27 = 62211 | (ord('\r') << 16) | (ord('\n') << 24)
>>> magic == magic27
True
>>> datetime.fromtimestamp(tstamp)
datetime.datetime(2011, 3, 8, 2, 39, 36)
>>> code = marshal.load(f)
>>> dis.dis(code)
1 0 LOAD_CONST 0 ('Bisection algorithms.')
3 STORE_NAME 0 (__doc__)
22 21 LOAD_NAME 65282
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dis.py", line 43, in dis
disassemble(x)
File "/usr/lib/python2.7/dis.py", line 97, in disassemble
print '(' + co.co_names[oparg] + ')',
IndexError: tuple index out of range It's no surprise if this bad file crashed the interpreter. Just delete it. |
Was this file generated by CPython from a .py file? If so, can you share the .py file? If not, how was this file generated? As eryksun says, it appears to not be a valid .pyc file. |
This file is created by fuzzer |
If it was created by a fuzzer then this isn't a bug as we do no validation of bytecode formatting as we assume it was generated by Python and not an external, malicious source. |
Said differently: you must not trust .py or .pyc downloaded from untrusted sources. Executing arbitary .py or .pyc file allows to execute arbitrary Python code. Instead of writing complex code to inject machine code in the Python evaluation loop (Python/ceval.c), just execute "import os; os.system('echo pwn!')" which runs an arbitrary shell command. Compile it to .pyc if you want to "exploit" the PYC path. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: