diff options
author | Malfurious <m@lfurio.us> | 2022-07-06 23:42:57 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2022-09-12 20:19:03 -0400 |
commit | 20dad07b1d9b666a0b86d11204e195af7be9d212 (patch) | |
tree | b4305efeab61f34989b74beb5145d04b18bcf266 | |
parent | 98c491856cb4dcbbee2af41194aa22e1ce0515a3 (diff) | |
download | sploit-20dad07b1d9b666a0b86d11204e195af7be9d212.tar.gz sploit-20dad07b1d9b666a0b86d11204e195af7be9d212.zip |
sploit: Fix bugs involving Symtbl base value
Some code previously assumed a Symtbl's base value to always be zero.
This was often the case, however the assumption would break (for example)
when attempting to rebase() a mapped Symtbl.
As of the previous patch enabling freer modification of base, the
potentiality of these bugs will be higher.
Signed-off-by: Malfurious <m@lfurio.us>
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r-- | sploit/mem.py | 2 | ||||
-rw-r--r-- | sploit/payload.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sploit/mem.py b/sploit/mem.py index 9ae0575..3a3e697 100644 --- a/sploit/mem.py +++ b/sploit/mem.py @@ -36,7 +36,7 @@ class Symtbl: self.sym[k] = v + off def rebase(self, off): - self.adjust(-off) + self.adjust(self.base - off) def __str__(_self): FMT = '\n{:<20} {:<20}' diff --git a/sploit/payload.py b/sploit/payload.py index 9fab65e..a7721e0 100644 --- a/sploit/payload.py +++ b/sploit/payload.py @@ -28,13 +28,13 @@ class Payload(Symtbl): return f'{kind}_{ctr}' def __append(self, value, sym): - setattr(self, sym, len(self)) + setattr(self, sym, self.base + len(self)) self._namesp.payload += value return self def __prepend(self, value, sym): self.adjust(len(value)) - setattr(self, sym, 0) + setattr(self, sym, self.base) self._namesp.payload = value + self._namesp.payload return self |