Closed Maijin closed 7 years ago
Which command do u like for doing this from r2? Maybe like wo?
On 07 Mar 2016, at 14:16, Maijin notifications@github.com wrote:
Hey, I think could be cool to add more useful crypto within r2 especially for malware analysis, here are some common one that can be found in pycrypto. See 3f5aa46 to know where/how to implement them
ARC2 ARC4 #4229 Blowfish XOR (with a string and not with just a byte like in rax2) CAST DES DES3 PKCS1_OAEP PKCS1_v1_5 Also a command to do that within r2 could be neat
Command for crypto — Reply to this email directly or view it on GitHub.
Can you find small and simple c implementations for all those algorithms?
On 07 Mar 2016, at 14:16, Maijin notifications@github.com wrote:
Hey, I think could be cool to add more useful crypto within r2 especially for malware analysis, here are some common one that can be found in pycrypto. See 3f5aa46 to know where/how to implement them
ARC2 ARC4 #4229 Blowfish XOR (with a string and not with just a byte like in rax2) CAST DES DES3 PKCS1_OAEP PKCS1_v1_5 Also a command to do that within r2 could be neat
Command for crypto — Reply to this email directly or view it on GitHub.
Yeah wo family command would be ok Here is the pycrypto repo with C code https://github.com/dlitz/pycrypto/tree/master/src
I'll work on implementing RC2.
I am working on XOR
cool guys :+1
This sounds fun! I'd like to work on Blowfish.
Note: as per issues filed there, the pycrypto library is no longer actively maintained (see this). Apparently development and other projects have moved to pycryptodome, which has everything pycrypto has and more.
for XOR encryption what can we do if the input contains null bytes. The rahash2.c will not pass the full string to the encryption plugin like for example : "rahash2 -S key -E XOR -s hello' world\n' " will give correct output but "rahash2 -S key -E XOR -s hello' world\n' | rahash2 -S key -E XOR -s - " will give 'h' as output as because in the output of the encryption there will be a null byte (ie e(xor)e )
I would prefer the lowercase name here: xor
On 07 Mar 2016, at 22:08, Pankaj Kataria notifications@github.com wrote:
for XOR encryption what can we do if the input contains null bytes. The rahash2.c will not pass the full string to the encryption plugin like for example : "rahash2 -S key -E XOR -s hello' world\n' " will give correct output but "rahash2 -S key -E XOR -s hello' world\n' | rahash2 -S key -E XOR -s - will give 'h' as output as because in the output of the encryption there will be a null byte (ie e(xor)e )
— Reply to this email directly or view it on GitHub.
I plan to work on implementing DES.
I have added in the issue:
Ability for rahash2 -E to handle file like rahash2 -S key -E rc4 file.exe
for example
we allready have DES, but it is broken
Should we consider the case of only one file provided, If not then please suggest suitable format to separate the output. Currently, I am printing newlines after every encrypted file.
@PankajKataria What u mean? Like decrypting/encrypting several file like rahash2 -S key -E rc4 file.exe file2.exe
and so on?
@Maijin Yup
AES is not done/not working in fact feel free to do add support for that as well :)
I'm going to fix aes algo
Cool!
Maybe @condret can point you to the issues he was having and the eay to integrated in esil. But for now just focus on implementing it for rahash2
Thanks
On 18 Mar 2016, at 22:47, Evgeny notifications@github.com wrote:
I'm going to fix aes algo
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub
I've done with most of the work for implementation here but there is still critical bug(s) that I still cannot find. So I really will be glad to receive any help with it
can you describe the bug? :P
On 22 Mar 2016, at 19:50, Evgeny notifications@github.com wrote:
I've done most of the work for implementation here https://github.com/l4l/radare2/commit/e27f953e6920a9cba12e6f929a6429d071e702fd but there is still critical bug(s) that I still cannot find. So I really will be glad to receive any help with it
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/radare/radare2/issues/4254#issuecomment-199959835
use valgrind, this is a clear buffer overflow at radare2/libr/crypto/crypto.c:120
On 22 Mar 2016, at 20:35, Evgeny notifications@github.com wrote:
Some wierd buffer overflow. Logs: gdb http://pastebin.com/sHj9YBKC, asan http://pastebin.com/7gifQDc6 — You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/radare/radare2/issues/4254#issuecomment-199979516
Modes should be written separately from the cipher algorithms so they can be reused easily. CBC is CBC is CBC. It doesn't matter whether it is AES-CBC or Blowfish-CBC. This way as new things get added, you automatically have all the modes for it. It's also just bad to write the same code 100x. You should be able to do something like (obviously with better naming and thinking of the arguments):
do_cbc_encrypt(aes, iv, input, output, length) do_cbc_decrypt(blowfish, iv, input, output, length)
etc...
Feel free to change the stuff :P But having all of those basics would be already cool prior doing fancy stuff...
I haven't looked at the code to see how it was structured yet, but I just wanted to make a note of it since I see CBC listed. It's going to be harder to change later if you don't plan ahead for it. Especially if people start wanting ofb, cfb, xts, and whatever popular thing will spring up next month. And malware authors like to be all trendy and use the fancy new modes, right?
RAT still used rot13, arc4, xor, aes-cbc a lot so definitely not fancy.
I was trying to be funny... :(
:?
ping
there is no 3DES yet.
See hxxps://github.com/radare/radare2/issues/6946
Hey, I think could be cool to add more useful crypto within r2 especially for malware analysis, here are some common one that can be found in pycrypto. See https://github.com/radare/radare2/commit/3f5aa46bd5177f18a6e784c45e0ec3da9c1eb266 to know where/how to implement them
It needs to be able to do that on file as well and Also a command to do that within r2 could be neat
rahash2 -S key -E rc4 file.exe
More related stuff here to do ! https://github.com/radare/radare2/issues/4280