Skip to content
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

OSError: seek to offset N is outside window #45

Open
tr4px opened this issue Feb 15, 2024 · 0 comments
Open

OSError: seek to offset N is outside window #45

tr4px opened this issue Feb 15, 2024 · 0 comments

Comments

@tr4px
Copy link

tr4px commented Feb 15, 2024

The following two malicious Mach-O files trigger an exception when loading the file:

Using version https://pypi.org/project/macholib/1.16.3/

08ebd550228fbcd8c85494192203347cf94cf251.zip (password "infected")
1491813dd0ead90e9107f58f6f2d2a71fd909e96.zip (password "infected")

Traceback (most recent call last):
  File "/home/user/mach.py", line 301, in parse
    mach = MachO(filepath)
  File "/usr/local/lib/python3.8/dist-packages/macholib/MachO.py", line 121, in __init__
    self.load(fp)
  File "/usr/local/lib/python3.8/dist-packages/macholib/MachO.py", line 136, in load
    self.load_header(fh, 0, size)
  File "/usr/local/lib/python3.8/dist-packages/macholib/MachO.py", line 171, in load_header
    hdr = MachOHeader(
  File "/usr/local/lib/python3.8/dist-packages/macholib/MachO.py", line 229, in __init__
    self.load(fh)
  File "/usr/local/lib/python3.8/dist-packages/macholib/MachO.py", line 316, in load
    fh.seek(seg.offset)
  File "/usr/local/lib/python3.8/dist-packages/macholib/util.py", line 91, in seek
    self._checkwindow(seekto, "seek")
  File "/usr/local/lib/python3.8/dist-packages/macholib/util.py", line 76, in _checkwindow
    raise IOError(
OSError: seek to offset 5673216 is outside window [0, 5165538]
Traceback (most recent call last):
  File "/home/user/mach.py", line 301, in parse
    mach = MachO(filepath)
  File "/usr/local/lib/python3.8/dist-packages/macholib/MachO.py", line 121, in __init__
    self.load(fp)
  File "/usr/local/lib/python3.8/dist-packages/macholib/MachO.py", line 136, in load
    self.load_header(fh, 0, size)
  File "/usr/local/lib/python3.8/dist-packages/macholib/MachO.py", line 171, in load_header
    hdr = MachOHeader(
  File "/usr/local/lib/python3.8/dist-packages/macholib/MachO.py", line 229, in __init__
    self.load(fh)
  File "/usr/local/lib/python3.8/dist-packages/macholib/MachO.py", line 316, in load
    fh.seek(seg.offset)
  File "/usr/local/lib/python3.8/dist-packages/macholib/util.py", line 91, in seek
    self._checkwindow(seekto, "seek")
  File "/usr/local/lib/python3.8/dist-packages/macholib/util.py", line 76, in _checkwindow
    raise IOError(
OSError: seek to offset 2390848 is outside window [0, 123440]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant