Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gmh5225/memory-relocalloc
Not my code. Only for saving
https://github.com/gmh5225/memory-relocalloc
Last synced: about 2 months ago
JSON representation
Not my code. Only for saving
- Host: GitHub
- URL: https://github.com/gmh5225/memory-relocalloc
- Owner: gmh5225
- License: mit
- Created: 2022-06-14T09:58:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-14T09:59:19.000Z (over 2 years ago)
- Last Synced: 2024-11-09T10:39:02.432Z (2 months ago)
- Language: C
- Homepage: https://gitlab.com/ORCA666/relocalloc
- Size: 482 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-game-security - Using .reloc section to replace the typical allocation calls
README
### RelocAlloc: Using .reloc section to replace the typical allocation calls
### Explaining the code:
- We first, locate the addresses of all the dlls mapped to our process.
- We then construct an array of structs and we fill it up with some data, thats **Initialize()** function.
- Now, we have a full array, next step is to search for the right address.
- calling **GetSuitableAddress(SIZE_T ShellcodeSize)** will do the job; thats finding us the right code cave (empty place in memory, fitting the shellcode size)
- in case it is found it will be returned.
- to use it we **must adjust** memory protection to be writable/executable ... (the poc is directly rwx)### Demo:
![img1](https://gitlab.com/ORCA666/relocalloc/-/raw/main/images/demo1.png)
![img2](https://gitlab.com/ORCA666/relocalloc/-/raw/main/images/demo2.png)
#### Note: this only work with small shellcodes, bcz it depends on the dlls mapped, the bigger the .reloc section, the bigger chances of getting a valid address. In addition, this is tested only on a `x64` machine, but it should work for x86 (i think :p)
# STAY TUNED FOR MORE
![120064592-a5c83480-c075-11eb-89c1-78732ecaf8d3](https://gitlab.com/ORCA666/kcthijack/-/raw/main/images/PP.png)