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

Add at rest encryption to Meterpreter payloads #679

Merged
merged 8 commits into from Oct 13, 2023

Conversation

sjanusz-r7
Copy link
Contributor

This PR adds in the generation of encrypted payload files using ChaCha20.
The files are automatically encrypted when the Rake tasks are called.
Using #read allows for the usage of encrypted and plain-text payloads as before.

ChaCha20 was chosen based on the following benchmarks on my developer machine:

First run:

~/Programming/benchmarks via 🐍 v3.11.5 via 💎 v3.0.5 
 ruby ./src.rb    
Warming up --------------------------------------
   plaintext binread     1.468k i/100ms
aes encrypted read (decrypting)
                       877.000  i/100ms
chacha20 encrypted read (decrypting)
                       785.000  i/100ms
rc4 encrypted read (decrypting)
                       459.000  i/100ms
Calculating -------------------------------------
   plaintext binread     14.506k (±10.1%) i/s -     71.932k in   5.009154s
aes encrypted read (decrypting)
                          8.835k (±12.0%) i/s -     43.850k in   5.034825s
chacha20 encrypted read (decrypting)
                          6.886k (±14.0%) i/s -     33.755k in   5.004575s
rc4 encrypted read (decrypting)
                          3.876k (±11.4%) i/s -     19.278k in   5.041633s

Comparison:
   plaintext binread:    14506.2 i/s
aes encrypted read (decrypting):     8835.0 i/s - 1.64x  slower
chacha20 encrypted read (decrypting):     6885.6 i/s - 2.11x  slower
rc4 encrypted read (decrypting):     3876.0 i/s - 3.74x  slower

Second run:

~/Programming/benchmarks via 🐍 v3.11.5 via 💎 v3.0.5 took 28s 
 ruby ./src.rb
Warming up --------------------------------------
   plaintext binread     1.214k i/100ms
aes encrypted read (decrypting)
                       881.000  i/100ms
chacha20 encrypted read (decrypting)
                       801.000  i/100ms
rc4 encrypted read (decrypting)
                       395.000  i/100ms
Calculating -------------------------------------
   plaintext binread     12.861k (± 7.5%) i/s -     64.342k in   5.032598s
aes encrypted read (decrypting)
                          7.570k (±15.3%) i/s -     37.002k in   5.003907s
chacha20 encrypted read (decrypting)
                          7.901k (±12.6%) i/s -     39.249k in   5.051235s
rc4 encrypted read (decrypting)
                          3.951k (±11.1%) i/s -     19.750k in   5.063716s

Comparison:
   plaintext binread:    12861.5 i/s
chacha20 encrypted read (decrypting):     7900.5 i/s - 1.63x  slower
aes encrypted read (decrypting):     7569.5 i/s - 1.70x  slower
rc4 encrypted read (decrypting):     3951.0 i/s - 3.26x  slower

gem/Rakefile Outdated Show resolved Hide resolved
@adfoster-r7 adfoster-r7 changed the title Encrypt payloads support Add at rest encryption to Meterpreter payloads Oct 13, 2023
@adfoster-r7 adfoster-r7 marked this pull request as ready for review October 13, 2023 11:55
@adfoster-r7 adfoster-r7 merged commit 5d29d8f into rapid7:master Oct 13, 2023
1 of 2 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants