This commit is contained in:
Z. Cliffe Schreuders
2024-11-15 10:13:48 +00:00
3 changed files with 14 additions and 5 deletions

View File

@@ -137,7 +137,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
<attack>
<prompt>Create a public and private RSA key pair within the <%= $chall_1_path %> directory using the file names key.pub and key.priv for the public and private key respectively.</prompt>
<post_command>grep 'BEGIN PRIVATE KEY' <%=$chall_1_path %>/key.priv > /dev/null; priv=$?; grep 'BEGIN PUBLIC KEY' <%=$chall_1_path %>/key.pub > /dev/null; pub=$?; echo $priv$pub</post_command>
<post_command>grep "BEGIN .*PRIVATE KEY" <%=$chall_1_path %>/key.priv > /dev/null; priv=$?; grep "BEGIN .*PUBLIC KEY" <%=$chall_1_path %>/key.pub > /dev/null; pub=$?; echo $priv$pub</post_command>
<suppress_command_output_feedback/>
<condition>
<output_matches>22</output_matches>
@@ -168,7 +168,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
<attack>
<prompt>Create another public and private RSA key pair within the <%= $chall_2_path %> directory using the file names key.pub and key.priv for the public and private key respectively. Encrypt a message file containing "<%= $chall_2_msg %>" using the public key and store the encrypted message within <%= $chall_2_path %>/message.enc</prompt>
<post_command>grep 'BEGIN PRIVATE KEY' <%=$chall_2_path %>/key.priv > /dev/null; priv=$?; grep 'BEGIN PUBLIC KEY' <%=$chall_2_path %>/key.pub > /dev/null; pub=$?; ls <%= $chall_2_path %>/message.enc 2> /dev/null; mfile=$?; msg_decrypt=`openssl pkeyutl -in <%= $chall_2_path %>/message.enc -decrypt -inkey <%= $chall_2_path %>/key.priv 2>/dev/null`; echo $priv$pub$mfile$msg_decrypt</post_command>
<post_command>grep "BEGIN .*PRIVATE KEY" <%=$chall_2_path %>/key.priv > /dev/null; priv=$?; grep "BEGIN .*PUBLIC KEY" <%=$chall_2_path %>/key.pub > /dev/null; pub=$?; ls <%= $chall_2_path %>/message.enc 2> /dev/null; mfile=$?; msg_decrypt=`openssl pkeyutl -in <%= $chall_2_path %>/message.enc -decrypt -inkey <%= $chall_2_path %>/key.priv 2>/dev/null`; echo $priv$pub$mfile$msg_decrypt</post_command>
<suppress_command_output_feedback/>
<condition>
<output_matches>000<%= $chall_2_msg %></output_matches>
@@ -202,7 +202,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
<get_shell>false</get_shell>
<post_command></post_command>
<prompt>Using the given values in the example above (p = 7, q = 23, N = 161, phiN = 132, e = (5,161), d = 53), decrypt the following ciphertext: "<%= $chall_3_ciphertext %>"</prompt>
<prompt>Using the given values in the example above (p = 7, q = 23, N = 161, phiN = 132, e = 5, d = 53), decrypt the following ciphertext: "<%= $chall_3_ciphertext %>"</prompt>
<condition>
<output_matches>OK</output_matches>
@@ -233,7 +233,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
<get_shell>false</get_shell>
<post_command></post_command>
<prompt>Using the given values in the example above (p = 7, q = 23, N = 161, phiN = 132, e = (5,161), d = 53), encrypt the following message: "<%= $chall_4_message %>"</prompt>
<prompt>Using the given values in the example above (p = 7, q = 23, N = 161, phiN = 132, e = 5, d = 53), encrypt the following message: "<%= $chall_4_message %>"</prompt>
<condition>
<output_matches>OK</output_matches>

View File

@@ -92,4 +92,13 @@ e.g. ord('Z') will return 90.
(41 ** d) % N
... etc ...
... etc ...
*** Decrypted message: 84 104 101 32 72 111 98 105 116 116 ***
>>> chr(84) # T
>>> chr(104) # h
>>> chr(101) # e
... etc ...
... etc ...
```
Note: chr() is the inverse of ord(), where chr takes an integer representation of a character as a parameter and returns the associated character.

View File

@@ -238,7 +238,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
</else_condition>
<quiz>
<question>What is the decrypted message?</question>
<answer><%= $dec_python_message %></answer>
<answer>.*<%= $dec_python_message %>.*</answer>
<correct_answer_response> :) <%= $flags.pop %></correct_answer_response>
<trigger_next_attack/>
</quiz>