Comments (5)
For those seeking more information about Go and donut, @odzhan added some checks to ensure the target PE has a .reloc section. Go EXEs do not normally build with .relocs (but Go DLLs do). donut will reject PEs without .relocs, thus Go EXEs do not work without some extra steps.
To get Go EXEs to work with donut, you'll need to build your executable with -buildmode=pie
. Unfortunately, this buildmode is not supported on windows/x86
and windows/amd64
unless you build with this patched version of Go. With this patched version of Go, you can just do a go build -buildmode=pie
and donut should now accept the EXE since it will have a .reloc section.
update: Go 1.15 supports buildmode=pie
by default for Windows executables.
from donut.
Currently, donut doesn't support unmanaged EXE/DLL files without relocation information (.reloc). There should have been a check for the PE directory before building the shell code, which is now present. If you try building shellcode from PE file with no .reloc information, you'll receive the following error.
[ Error : This file has no relocation information required for in-memory execution.
Callback addresses in the TLS directory are absolute and are relatively simple to get working without .reloc information. However, code in the actual callback function may also use absolute addresses for data variables, and this is what causes the EXE file to crash the host process. To support relocating the code without .reloc information embedded in the PE file would require a built-in disassembler :) Perhaps it can be implemented in future, because it's certainly doable.
The TLS callbacks for DLL are only executed when the process begins and not for a new thread or when the process ends, which is required. For the moment, I've disabled support for PE files that do not contain relocation information. DLL files will still load, although there are likely to be issues supporting TLS.
from donut.
was using x86 runsc against x64 DLL payload.bin. doh! DLL works. 😄 see this comment's revision history for a full look at my stupidity. thanks @odzhan for setting me straight.
from donut.
No problem! I've done it myself many times during development 😁
from donut.
If someone faces the same problem with gcc compiled executables -> Add those flags to the compiler
-Wl,--dynamicbase,--export-all-symbols
https://stackoverflow.com/questions/19451652/mingw-relocation-table
from donut.
Related Issues (20)
- Support for executables without relocation data HOT 2
- How does work on 32bit
- Huffman in version 1.0
- A generator written in pure Go, supporting Donut v1.0
- Add support for resources HOT 1
- TLS handling referencing the wrong headers
- shellcode gen with error?
- capturing stdout of a donut HOT 1
- Running donut only brings up help menu HOT 4
- Suggestion on encoding the loader HOT 1
- [Feature] - ARM64 support HOT 2
- Rsp adjustment breaks shellcode return HOT 1
- Files with SEH support HOT 2
- Shellcode terminates main thread HOT 1
- Module overloading does not work
- Does donut supports injecting into processes with Dynamic Code Prohibited enabled
- No execution with Akagi64 (UACME) HOT 1
- New Detections on AMSI Patch and Headers
- Problem executing Golang binaries HOT 2
- Anti Dump for .Net assemblies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from donut.