Commit Graph

271 Commits

Author SHA1 Message Date
Spencer McIntyre 1cd5b707bb Add additional platforms and decoders 2024-02-13 18:34:40 +01:00
Spencer McIntyre 49e689d909 Some improvements to the encoder
* Skip encoding when it is not necessary
* Use command -v instead of which for portability
2024-02-13 18:34:40 +01:00
Spencer McIntyre 9c6e1a584a Add a base64 ARCH_CMD encoder 2024-02-13 18:34:40 +01:00
Spencer McIntyre b31abcc9b2 Mark unix encoders as compatible with linux
Fixes #18572
2024-01-19 13:40:43 -05:00
h00die 04c0dede5e fix spelling in some modules 2024-01-07 14:06:31 -05:00
Grant Willcox 7728e1e2fb
Add in new library function for escaping PowerShell literals 2023-06-02 10:22:56 -05:00
Grant Willcox 965311d09e
Fix documentation and fix bug in creating PARMS value 2023-06-02 09:48:02 -05:00
Grant Willcox 3ab4173d6c
Fix up base64 encoder to properly quote strings - credit to @smcintyre-r7 for the fix 2023-06-02 09:48:02 -05:00
wvu f5bec517a0
Escape braces after all in cmd/brace encoder
Previously escaped only commas.
2023-05-25 23:46:18 -05:00
Arthur RAOUT 889aff9701 Revert accidental changes Merge branch 'upstream-master' into New_x86_xor_encoder 2023-03-08 13:41:26 +01:00
Grant Willcox 975de9d479
Supply exception message when raising BadcharError and fix typo 2023-03-02 17:46:21 -06:00
jvoisin 5b82c952ba Rubocop pass 2023-03-02 21:43:41 +01:00
jvoisin ae549ce1d4 Fix PHP base64 encoding 2023-03-02 21:40:27 +01:00
Arthur RAOUT 7b7377257e fixed 2 rubocop offenses 2023-03-02 13:08:09 +01:00
Arthur RAOUT e178226efa Merge branch 'New_x86_xor_encoder' of github.com:araout42/metasploit-framework into New_x86_xor_encoder 2023-03-02 12:31:21 +01:00
Arthur RAOUT 1461f9fb03 slight changes in the comments 2023-03-02 12:30:38 +01:00
Professor Araout 83bcd1cc1b
Fix typo in the comments line 41
Co-authored-by: Brendan <bwatters@rapid7.com>
2023-03-02 11:50:56 +01:00
Arthur RAOUT d83c2c3a5d Remove useless loop that select reg1, because we now have push/pop all regs to preserve them 2023-01-04 17:40:22 +01:00
Arthur RAOUT 676fda73b1 Remove useless loop that select reg1, because we now have push/pop all regs to preserve them 2023-01-04 17:39:59 +01:00
Arthur RAOUT 7494318ec4 Fix offset from entrypoint 2023-01-04 17:36:55 +01:00
Arthur RAOUT 93f579b180 Fixed shuffling of registers with generate preserve reg function 2023-01-04 17:33:24 +01:00
Arthur RAOUT 0a99e2be6a Fixed 3 offense rubocop/msftidy 2023-01-04 17:25:25 +01:00
Arthur RAOUT bdf5f8fbe4 Added preserver register through random order push and pop of the registers, change name to xor_poly.rb 2023-01-04 17:21:48 +01:00
Professor Araout 0a53cab369
Update xor.rb
Remove outdated comments
2022-12-20 17:03:50 +01:00
Arthur RAOUT 45d0eb8bb4 Add encoder module x86/xor at path modules/encoder/x86/xor.rb, Rubocop clean, msftidy clean, No documentation written 2022-12-20 15:54:01 +01:00
gwillcox-r7 1d3f0be495 RuboCop unicode_upper.rb and unicode_mixed.rb 2020-05-02 21:51:05 -05:00
gwillcox-r7 123d33679a Fix Unicode encoders to meet RuboCop standards 2020-05-02 21:36:10 -05:00
Paolo 'VoidSec' Stagno 5db675a683 changed in OptString 2020-05-02 15:14:38 +02:00
Paolo 'VoidSec' Stagno aeebe6e0f1 fixing text description 2020-05-01 16:48:43 +02:00
Paolo 'VoidSec' Stagno 90304c5ced Unicode Encoders, 'Buffer Register' fixes
https://github.com/rapid7/metasploit-framework/issues/13372
2020-05-01 16:41:30 +02:00
O . S . O 51fe61838d
Create xor_context.rb 2019-07-01 10:36:08 +02:00
Brendan Coles 5957315167
Land #11141, Ensure Byte XORi Encoder uses cacheflush() 2018-12-29 10:20:07 +00:00
Pedro Ribeiro 1e88ce9a3d
Edit the comments to -84 2018-12-18 16:33:44 +00:00
Pedro Ribeiro 05218654f4
adjust the offset to -84 2018-12-18 16:30:47 +00:00
Pedro Ribeiro af418ec7f7
Fix mipsle byte_xori too 2018-12-18 16:05:23 +00:00
Pedro Ribeiro d40d6c4e3d
Update longxor.rb
Suffers from the same problem as the mipsbe version
2018-12-18 15:48:29 +00:00
Pedro Ribeiro 34c9555717
Fix byte_xori encoder
The byte_xori encoder for mipsbe does not work correctly. At the end of the decoding, it should invoke cacheflush() with the correct parameters:
int cacheflush(char *addr, int nbytes, int cache)

I think this is because the encoder is based of the longxori encoder, which itself is pretty old (2008), and before kernel 2.6.11, cacheflush() did not need any parameters (from the cacheflush man page):
BUGS
Linux kernels older than version 2.6.11 ignore the addr and nbytes arguments, making this function fairly expensive. Therefore, the whole cache is always flushed.

This commit fixes that by setting up the parameters correctly. As an unfortunate side effect this increases the shellcode by 16 bytes, but it is absolutely necessary for it to work properly.

Note that this bug is not present when testing the encoder output on an emulator like qemu; emulators do not need to flush the caches to work properly.
2018-12-18 15:37:47 +00:00
Pedro Ribeiro 86cbddf46d
fix spacing 2018-12-18 13:35:16 +00:00
Pedro Ribeiro fff850a07e
Make longxor encoder great again
The longxor encoder for mipsbe does not work correctly. At the end of the decoding, it should invoke cacheflush() with the correct parameters:
int cacheflush(char *addr, int nbytes, int cache)

The encoder previously did not setup the arguments, as it even said so in the comments:
;       addiu   $4, $16, -4       ; not checked by Linux
;       li      $5,40                   ; not checked by Linux
;       li      $6,3                    ; $6 is set above

I think this is because the encoder is pretty old (2008), and before kernel 2.6.11, cacheflush() did not need any parameters (from the cacheflush man page):
BUGS
       Linux  kernels older than version 2.6.11 ignore the addr and nbytes arguments, making this function fairly expensive.  Therefore, the
       whole cache is always flushed.

This commit fixes that by setting up the parameters correctly. As an unfortunate side effect this increases the shellcode by 16 bytes, but it is absolutely necessary for it to work properly. 

Note that this bug is not present when testing the encoder output on an emulator like qemu; emulators do not need to flush the caches to work properly.

As an added bonus I have also made it compatible with toupper() restrictions, which is common in web server exploits too. This did not add any extra bytes to the encoder.
2018-12-18 12:30:55 +00:00
Francesco Soncina 6237740116
lint: remove spaces 2018-12-15 01:02:13 +01:00
Francesco Soncina ff2d048530
fixes: update x86/xor_dynamic for #11100 2018-12-10 22:45:45 +01:00
Francesco Soncina a94e52ca31
fixes: updates x64/xor_dynamic for #11100 2018-12-10 22:42:31 +01:00
bwatters-r7 08ec8e1ef9
Land #10553, add x86/xor_dynamic and x64/xor_dynamic encoders
Merge branch 'land-10553' into upstream-master
2018-10-30 09:56:15 -05:00
stefano118 2ba53143f1
refactor: optimized stub
refactor: optimized stub

refactor: optimized stub
2018-09-01 03:17:17 +02:00
stefano118 6c1a83d464
refactor: snake case 2018-09-01 03:17:17 +02:00
stefano118 27d7d17deb
refactor: beautify stub
refactor: beautify stub

refactor: beautify stub

refactor: beautify stub
2018-09-01 03:17:16 +02:00
phra 6b32bdbba9
feat: add x86 xor_dynamic encoder 2018-09-01 03:17:16 +02:00
phra 3b04e8e569
feat: add x64 xor_dynamic encoder 2018-09-01 03:17:15 +02:00
stefano118 93e9253aeb
Update countdown.rb 2018-09-01 02:40:26 +02:00
phra a282d2a8b1
fix: rescue rex runtime errors in x86/nonalpha 2018-08-30 01:22:24 +02:00