RsaCtfTool

Finally solved it, not sure if I solved it using an intented way as I do not understand the relevance of the challenge name. Also something is wrong with my openssl as I was getting “bad magic number” on the last step, so used an online tool to perform aes decryption

Type your comment> @joeblogg801 said:

Finally solved it, not sure if I solved it using an intented way as I do not understand the relevance of the challenge name. Also something is wrong with my openssl as I was getting “bad magic number” on the last step, so used an online tool to perform aes decryption

rsactftool will not at all help in solving the challenge

Type your comment> @R4J said:

Type your comment> @joeblogg801 said:

Finally solved it, not sure if I solved it using an intented way as I do not understand the relevance of the challenge name. Also something is wrong with my openssl as I was getting “bad magic number” on the last step, so used an online tool to perform aes decryption

rsactftool will not at all help in solving the challenge

Thank you for this.

I’m absolutely not even started yet, but you’ve just saved me from a very disappointing rabbit hole.

Well, I found that the key is 192 bytes long if you assume that the key is hex… Meaning that it gives me a hint for the one type of encryption the symmetrical one. I’m guessing that there should be an asymmetrical type of encryption probably. One over the other but i cannot find out which is over the other.

I really liked this challenge.
After understanding the “peculiarity” of the challenge I enjoyed studying the difference with how I tipically approach this encryption type.
I like when challenges teach you something.

Interesting challenge, learned a lot. I struggled a lot with the tools (openssl and such) and though I suspected (correctly) what the solution should be, it was really difficult for me to execute it just right and work around all the tooling issues.

Resolved! The challenge is very interesting, the name only helps to discard things hahaha

if they’re lost with the “key” file here a hint;
You should know that RSA is used to share symmetric encryption keys, not to encrypt messages.
if you need it you can send MP

Thanks to @kd3n4, I was able to solve this. It’s actually good ol’ fundamental and basic mathematics (modular arithmetic to be precise). You just need a really good calculator. No, not Windows calculator.

i think my decrypt is correct because i can read the "key file: se****** ", but i can’t decrypt with openssl (i get bad magic number) and the online tools… if someone can help me, a small detail that i forget… thank’s

got it, I hadn’t used the right online tool, feel free to PM me. thanks @kd3n4

Nice challenge. As others, I had some trouble with the “bad magic” error message using openssl. But this is due to a very silly thing: all you need to do is to remove the last byte of the encrypted flag (0xa), because that’s new line character, thus not “padding” to 32 bytes.

Cheers,

openssl x509 -in pubkey.pem -text -noout
unable to load certificate
139961896822080:error:0909006C:PEM routines:get_name:no start line:crypto/pem/pem_lib.c:745:Expecting: TRUSTED CERTIFICATE

why I can’t detect the size of rsa key from that pem?
can someone help?

With this: “openssl rsa -inform PEM -text -noout -pubin -in pubkey.pem”

RSA Public-Key: (1535 bit)
Modulus:
77:d1:e3:2b:fe:41:fb:07:61:2b:cb:95:2e:8b:19:
6d:9c:30:39:41:dd:19:47:d4:fb:5e:0f:b8:0d:ea:
75:38:2a:1c:8c:95:1c:e7:39:44:08:ed:c8:01:d3:
cd:9b:b4:c5:ac:d6:eb:0f:61:f5:12:ae:a9:03:b3:
ed:44:0e:bc:f3:c3:8d:8c:1b:af:37:62:f2:e5:25:
17:dc:3b:6b:32:73:e6:0d:25:30:ea:b5:51:d6:e5:
5d:d2:34:9d:89:f9:62:82:c3:40:39:f9:a6:f6:a8:
0f:ac:7e:14:45:86:f3:c9:ee:0b:0b:bd:48:fe:6e:
5b:79:ab:07:b2:19:58:5e:30:e4:2f:cb:e5:97:23:
e5:62:fe:3c:2d:95:6d:e2:b7:6e:64:04:b6:54:a0:
44:83:06:0f:87:64:a9:f1:cf:73:20:70:9e:97:ae:
83:1d:8c:f3:f0:4c:7d:9f:f2:c3:ab:09:32:35:8c:
9c:cd:51:8c:49:f4:94:34:40:f4:eb:c7
Exponent: 65537 (0x10001)

I’m totally stuck on it, I think I have understood the goal but I can’t figure out how to reach it… Can I PM some one ?

anyone able to provide any pointers? Keep getting bad magic number

for anyone struggling with getting the flag to decrypt - I couldn’t find a working online tool so just used pycrypto instead and it should work first time :slight_smile:

Whoever made this flag aught to be slapped straight across the face. The numbers they chose makes it almost impossible to get the ■■■■ thing into a format that you can use utilities with. And doing it by hand doesn’t work either because the “key” message cannot be decoded using the normal format. The way you’d normally do it doesn’t work so you have to use a different method that does encrypt and decrypt messages but upon attemping it doesn’t work.

No matter what you do. It will no decrypt with openssl “bad magic number”. So you have to either a) use an online tool. b) use some python utility to do aes(or similar library). or c) write your own to do it. Whoever decided to use that prime I hate you.

Type your comment> @133794m3r said:

Whoever made this flag aught to be slapped straight across the face. The numbers they chose makes it almost impossible to get the ■■■■ thing into a format that you can use utilities with. And doing it by hand doesn’t work either because the “key” message cannot be decoded using the normal format. The way you’d normally do it doesn’t work so you have to use a different method that does encrypt and decrypt messages but upon attemping it doesn’t work.

No matter what you do. It will no decrypt with openssl “bad magic number”. So you have to either a) use an online tool. b) use some python utility to do aes(or similar library). or c) write your own to do it. Whoever decided to use that prime I hate you.

■■■■ wut

This was definitely one of the most challenging for me in terms of calculations. However, with the assistance of @kd3n4 and @m4nu, I finally got my head around it.

Here’s some hints to get you moving

  • The modulus is specific type of number, noticeable when factored.
  • The function to determine decryption handles that specific type in a certain way. The wiki page will explain it more.
  • As @socialkas states, the “bad magic number” is a result of a newline character.

Feel free to PM me or catch me on Discord.