diff --git a/lib/objects/system.rb b/lib/objects/system.rb
index 30dbd4b2f..1012fe9eb 100644
--- a/lib/objects/system.rb
+++ b/lib/objects/system.rb
@@ -208,37 +208,42 @@ class System
datastore_access = datastore_variablename_and_access_type['access']
datastore_variablename = datastore_variablename_and_access_type['variablename']
datastore_retrieved = []
- if datastore_access == 'first'
- datastore_retrieved = [$datastore[datastore_variablename].first]
- elsif datastore_access == 'next'
- last_accessed = $datastore_iterators[datastore_variablename]
- # first use? start at beginning
- if last_accessed == nil
- index_to_access = 0
+ begin
+ if datastore_access == 'first'
+ datastore_retrieved = [$datastore[datastore_variablename].first]
+ elsif datastore_access == 'next'
+ last_accessed = $datastore_iterators[datastore_variablename]
+ # first use? start at beginning
+ if last_accessed == nil
+ index_to_access = 0
+ else
+ index_to_access = last_accessed + 1
+ end
+ $datastore_iterators[datastore_variablename] = index_to_access
+ datastore_retrieved = [$datastore[datastore_variablename][index_to_access]]
+ elsif datastore_access == 'previous'
+ last_accessed = $datastore_iterators[datastore_variablename]
+ # first use? start at end
+ if last_accessed == nil
+ index_to_access = $datastore[datastore_variablename].size - 1
+ else
+ index_to_access = last_accessed - 1
+ end
+ $datastore_iterators[datastore_variablename] = index_to_access
+ datastore_retrieved = [$datastore[datastore_variablename][index_to_access]]
+ elsif datastore_access.to_s == datastore_access.to_i.to_s
+ # Test for a valid element key (integer)
+ index_to_access = datastore_access.to_i
+ $datastore_iterators[datastore_variablename] = index_to_access
+ datastore_retrieved = [$datastore[datastore_variablename][index_to_access]]
+ elsif datastore_access == "all"
+ datastore_retrieved = $datastore[datastore_variablename]
else
- index_to_access = last_accessed + 1
+ Print.err "Error: invalid access value (#{datastore_access})"
+ raise 'failed'
end
- $datastore_iterators[datastore_variablename] = index_to_access
- datastore_retrieved = [$datastore[datastore_variablename][index_to_access]]
- elsif datastore_access == 'previous'
- last_accessed = $datastore_iterators[datastore_variablename]
- # first use? start at end
- if last_accessed == nil
- index_to_access = $datastore[datastore_variablename].size - 1
- else
- index_to_access = last_accessed - 1
- end
- $datastore_iterators[datastore_variablename] = index_to_access
- datastore_retrieved = [$datastore[datastore_variablename][index_to_access]]
- elsif datastore_access.to_s == datastore_access.to_i.to_s
- # Test for a valid element key (integer)
- index_to_access = datastore_access.to_i
- $datastore_iterators[datastore_variablename] = index_to_access
- datastore_retrieved = [$datastore[datastore_variablename][index_to_access]]
- elsif datastore_access == "all"
- datastore_retrieved = $datastore[datastore_variablename]
- else
- Print.err "Error: invalid access value (#{datastore_access})"
+ rescue NoMethodError, SyntaxError => err
+ Print.err "Error accessing element (#{datastore_access}) from datastore (#{datastore_variablename}): #{err}"
raise 'failed'
end
if datastore_retrieved && datastore_retrieved != [nil]
@@ -457,4 +462,4 @@ class System
modules_to_add
end
-end
\ No newline at end of file
+end
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/hbauthentication.pp b/modules/generators/structured_content/hackerbot_config/hbauthentication/hbauthentication.pp
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/manifests/.no_puppet b/modules/generators/structured_content/hackerbot_config/hbauthentication/manifests/.no_puppet
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/secgen_local/local.rb b/modules/generators/structured_content/hackerbot_config/hbauthentication/secgen_local/local.rb
new file mode 100644
index 000000000..91be58494
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hbauthentication/secgen_local/local.rb
@@ -0,0 +1,35 @@
+#!/usr/bin/ruby
+require_relative '../../../../../../lib/objects/local_hackerbot_config_generator.rb'
+
+class HB < HackerbotConfigGenerator
+
+ attr_accessor :server_ip
+
+ def initialize
+ super
+ self.module_name = 'Hackerbot Config Generator Authentication'
+ self.title = 'Authentication'
+
+ self.local_dir = File.expand_path('../../',__FILE__)
+ self.templates_path = "#{self.local_dir}/templates/"
+ self.config_template_path = "#{self.local_dir}/templates/lab.xml.erb"
+ self.html_template_path = "#{self.local_dir}/templates/labsheet.html.erb"
+
+ self.server_ip = []
+ end
+
+ def get_options_array
+ super + [['--server_ip', GetoptLong::REQUIRED_ARGUMENT]]
+ end
+
+ def process_options(opt, arg)
+ super
+ case opt
+ when '--server_ip'
+ self.server_ip << arg;
+ end
+ end
+
+end
+
+HB.new.run
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/secgen_metadata.xml b/modules/generators/structured_content/hackerbot_config/hbauthentication/secgen_metadata.xml
new file mode 100644
index 000000000..59d09fa03
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hbauthentication/secgen_metadata.xml
@@ -0,0 +1,39 @@
+
+
+
+ Hackerbot config for a authentication lab
+ Z. Cliffe Schreuders
+ GPLv3
+ Generates a config file for a hackerbot for an integrity lab.
+ Topics covered: .
+
+ hackerbot_config
+ linux
+
+ accounts
+ flags
+ root_password
+
+
+
+
+
+
+ vagrant
+
+
+
+
+
+
+
+
+
+ puppet
+
+
+ hackerbot
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/shared/labsheet.html.erb b/modules/generators/structured_content/hackerbot_config/hbauthentication/shared/labsheet.html.erb
new file mode 100644
index 000000000..72dab611a
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hbauthentication/shared/labsheet.html.erb
@@ -0,0 +1,29 @@
+
+
+ <%= self.title %>
+
+
+
+
+
+
+
+ <%= self.html_rendered %>
+
+
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/shared/license.md.erb b/modules/generators/structured_content/hackerbot_config/hbauthentication/shared/license.md.erb
new file mode 100644
index 000000000..8e89ace31
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hbauthentication/shared/license.md.erb
@@ -0,0 +1,4 @@
+## License
+This lab by [*Z. Cliffe Schreuders*](http://z.cliffe.schreuders.org) at Leeds Beckett University is licensed under a [*Creative Commons Attribution-ShareAlike 3.0 Unported License*](http://creativecommons.org/licenses/by-sa/3.0/deed.en_GB).
+
+Included software source code is also licensed under the GNU General Public License, either version 3 of the License, or (at your option) any later version.
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/intro.md.erb b/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/intro.md.erb
new file mode 100644
index 000000000..4fb95fc32
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/intro.md.erb
@@ -0,0 +1,299 @@
+# Authentication
+
+## Getting started
+### VMs in this lab
+
+==Start these VMs== (if you haven't already):
+- hackerbot_server (leave it running, you don't log into this)
+- desktop (you can sudo to get superuser access)
+- server (<%= $server_ip %>, you can ssh to this machine, but you don't have superuser access)
+- kali_cracker (you will use this to crack the hashes you find)
+
+### Your login details for the "desktop" and "server" VMs
+User: <%= $main_user %>
+Password: tiaspbiqe2r (**t**his **i**s **a** **s**ecure **p**assword **b**ut **i**s **q**uite **e**asy **2** **r**emember)
+
+You won't login to the hackerbot_server, but the VM needs to be running to complete the lab.
+
+### For marks in the module
+1. **You need to submit flags**. Note that the flags and the challenges in your VMs are different to other's in the class. Flags will be revealed to you as you complete challenges throughout the module. Flags look like this: ==flag{*somethingrandom*}==. Follow the link on the module page to submit your flags.
+2. **You need to document the work and your solutions in a Log Book**. This needs to include screenshots (including the flags) of how you solved each Hackerbot challenge and a writeup describing your solution to each challenge, and answering any "Log Book Questions". The Log Book will be submitted later in the semester.
+
+## Meet Hackerbot!
+
+
+This exercise involves interacting with Hackerbot, a chatbot who will attack your system. If you satisfy Hackerbot by completing the challenges she will reveal flags to you.
+
+**On the desktop VM:**
+
+==Open Pidgin and send some messages to Hackerbot:==
+
+- Try asking Hackerbot some questions
+- Send "help"
+- Send "list"
+- Send "hello"
+
+> If Hackerbot seems to be waiting or halted, simply say 'hi'
+
+Work through the below exercises, completing the Hackerbot challenges as noted.
+
+---
+
+## Introduction to authentication
+
+Authentication plays the important role of verifying an identity. For example, when someone gets into an airplane, sits down at a computer, picks up a mobile device, or uses a website, authentication is what is used to confirm that the person is who they claim to be. Authentication is an important first step *before* deciding how the system should act and what to allow.
+
+## Identity: users and groups
+
+Most computer systems have the concept of a user account. Although some devices such as mobile phones typically only have one user account, most modern computers can support having multiple users, each with their own identity. For example, a computer can have a separate account for each person that uses it, and if configured to do so may enable each user to have their own account preferences, and access to different resources.
+
+On Unix/Linux systems every user account is identified by a user ID number (UID), which is a 32-bit integer (whole number), and can have one or more user names, which are human readable strings of text.
+
+**On the desktop VM:**
+
+Open a terminal console.
+
+Assuming you have already logged in, you have already authenticated yourself on this system.
+
+==Log Book Question: When and how did you authenticate yourself?==
+
+Use these commands to find out about your current identity (or more accurately the identity of the software you are interacting with):
+
+```bash
+whoami
+
+groups
+
+id
+```
+
+==Make a note of your UID and username.==
+
+Note that your account is also a member of one or more groups. A primary group, and a list of other groups. Some Linux systems, such as Debian, create a new seperate primary group for each user, others such as openSUSE have a shared group (named "users") that all normal users are a member of. Similar to the relationship between user names and UIDs, each group has a group name, and a group ID (GID).
+
+Information about user accounts is stored in the /etc/passwd file, which typically all users can read.
+
+==View the /etc/passwd file:==
+
+```bash
+less /etc/passwd
+```
+
+==Find the line that describes your user account.==
+
+This line defines the username, password (well, it used to be stored here... we will come back to this), UID, primary group GID, full name, home directory, and shell for your account.
+
+Confirm this matches the information you recorded earlier.
+
+==Find the line that describes the root user account.==
+
+==Where is the root user's home directory?==
+
+> Press 'q' to quit less.
+
+==View the /etc/group file:==
+
+```bash
+less /etc/group
+```
+
+Groups are defined in this file, along with which users are members.
+
+==Which users are members of the audio group?==
+
+Remember, primary groups do not appear in this file; for example, on openSUSE the "users" group, which all normal users are a member of, may not appear in the /etc/group file.
+
+The "su" program can be used to run a program (usually a shell; that is, a command prompt) as another user, effectively enabling users to switch between user accounts at the command prompt.
+
+==Change your identity to root==. Run:
+
+```bash
+su -
+```
+
+Enter the root password.
+
+Use these commands to ==find out about your new identity:==
+
+```bash
+whoami
+
+groups
+
+id
+```
+
+==What is the UID of root? What does this mean about this user?==
+
+==Lab Book Question: What gives this user special privileges: the name of the account, or the UID?==
+
+==Use the useradd command to create a new user account "fred"==
+
+> Hint: refer to the man page for useradd, by running "man useradd".
+
+==Set a password for the user fred.==
+
+> Hint: `sudo passwd fred`
+
+==Change identity to fred.==
+
+> Hint: `su - fred`
+
+==Run:(after su)==
+
+```bash
+id
+```
+
+==Compare the result to the previous output.==
+
+==How does this compare to your other normal user account? What is different, and what about it is the same?==
+
+Run the single command "id" as root:
+
+```bash
+sudo id
+```
+
+==Log Book Question: What is the difference between sudo and su? Which is most likely protect against accidental damage and also log the commands used?==
+
+## Users and SSH
+
+==Log in to the server via ssh:==
+
+```bash
+ssh <%= $main_user %>@<%= $server_ip %>
+```
+
+==Display details of all users logged on to the system:==
+
+```bash
+who
+```
+
+==List all the processes run by all users:==
+
+```bash
+ps -eo user,comm
+```
+
+==List all the processes running as root:==
+
+```bash
+ps -o user,comm -u root
+```
+
+==Run a command to list all the processes running as *your* normal user.==
+
+==Lab Book Question: How is this server authenticating users? What user accounts exist?==
+
+## Passwords, hashes and salt
+
+Given that important security decisions are made based on the user accounts, it is important to authenticate users, to ensure that the subjects are associated with the correct identity.
+
+==What are the kinds of factors that can be used to verify a user's identity? Hint: for example, "something they have".==
+
+==Which category of authentication factors is a password considered to be?==
+
+Originally passwords were stored "in the clear" (not enciphered). For example, Multics stored passwords in a file, and once at MIT a software bug caused the password file to be copied to the motd file (message of the day), which was printed every time anyone logged into the system. A solution is not to store the password in the clear. Instead a hash can be computed, using a one way hash function, and stored. When the user enters a password, a new hash is computed and compared to the original.
+
+On Linux, the command "shasum" can be used to check the integrity of files (hash functions have many uses), and works on the same principle. We can use it to generate a hash for any given string, for example a password:
+
+```bash
+shasum
+```
+
+> Type "hello" without the quotes. Press Ctrl-D (which indicates "EOF"; that is, end of input).
+
+Repeat the above, with the same password ("hello"), and with a slight difference ("hello.").
+
+Are the outputs the same?
+
+Are the different hashes similar?
+
+Is this good? Why?
+
+Which one-way hash function does the shasum program use? Would this be a good option for hashing passwords?
+
+For password authentication, the hash still needs to be stored. On Unix, password hashes were once stored in the world-readable file /etc/passwd, now they are typically stored in /etc/shadow, which only root (the superuser) can access.
+
+==View the shadow file:==
+
+```bash
+sudo less /etc/shadow
+```
+
+The format of the shadow file is:
+
+> username:**password**:last-changed(since 1-1-1970):days-until-may-change:days-until-must-change:days-warning-notice:days-since-expired-account-disabled:date-disable:reserved-field
+
+==Find the hash of your user account's password.==
+
+> Exit less ("q").
+
+Use the passwd command to ==change your password:==
+
+```bash
+passwd
+```
+
+> When prompted, enter a new password of your choosing.
+
+View the shadow file, and confirm that the stored password has changed.
+
+With reference to the shadow file, and the man page for crypt (Hint: "man crypt"), ==answer these Log Book questions==:
+
+- On Linux, the password hash stored in /etc/shadow has a prefix that specifies the hash function used.\
+ > ==What hash function is used for your password?==
+ > Hint: the `hash-identifier` command line tool may also help.
+
+- ==When was the root password last changed?==
+
+- ==Do any accounts have a setting that will force a password change at a specific date?==
+
+A salt is a random string, used as further input into a one-way hash function (concatenated to the password). The salt is typically stored along with the hash. As a result the same password will have different hashes, so long as the salt is different.
+
+Why is that a good thing?
+
+What kind of attack does a salt defend against?
+
+What is the current salt for your account? Hint: it is stored after the second "\$".
+
+## Password weaknesses
+
+The strength of a password depends on its entropy: its degree of randomness. If a user chooses a word from a dictionary, it would not take long to attempt every dictionary word until finding one that results in the same hash.
+
+Try your hand at cracking passwords using the Kali virtual machine.
+
+**On your desktop VM:**
+Add some new users with these passwords:
+> Hello
+>
+> hellothere
+>
+> password1
+
+**On your Kali VM:**
+==Use John the Ripper (or Johnny a GUI for the John the Ripper) to crack the passwords.==
+> Hint: `man john`, on the Kali Linux system.
+> You will need to combine the passwd and shadow files (manually or with the kali `unshadow` command.)
+
+==Log Book Questions:==
+- Which passwords are cracked the fastest?
+
+- How long did they take?
+
+
+## Conclusion
+
+At this point you have:
+
+- Applied authentication concepts to Unix/Linux
+
+- Experimented with user accounts and identity
+
+- Experimented with one-way hash functions, salts, and password storage
+
+- Cracked passwords with low entropy using dictionary attacks
+
+Well done!
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/lab.xml.erb b/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/lab.xml.erb
new file mode 100644
index 000000000..20053effd
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/lab.xml.erb
@@ -0,0 +1,161 @@
+<%
+ require 'json'
+ require 'securerandom'
+ require 'digest/sha1'
+ require 'fileutils'
+ require 'erb'
+
+ if self.accounts.empty?
+ abort('Sorry, you need to provide an account')
+ end
+
+ $first_account = JSON.parse(self.accounts.first)
+
+ $main_user = $first_account['username'].to_s
+ $main_user_pass = $first_account['password'].to_s
+
+ $server_ip = self.server_ip.first
+ $root_password = self.root_password
+ $flags = self.flags
+
+ REQUIRED_FLAGS = 1
+ while $flags.length < REQUIRED_FLAGS
+ $flags << "flag{#{SecureRandom.hex}}"
+ Print.err "Warning: Not enough flags provided to hackerbot_config generator, some flags won't be tracked/marked!"
+ end
+
+ def get_binding
+ binding
+ end
+%>
+
+
+
+
+
+ Hackerbot
+
+ config/AIML
+
+
+ sshpass -p <%= $root_password %> ssh -oStrictHostKeyChecking=no root@{{chat_ip_address}} /bin/bash
+
+
+
+
+ Hi there. Today I'm your boss of sorts. I need you to test the security of our server. Help out and I'll give you some flags.
+
+
+ When you are ready, simply say 'ready'.
+ 'Ready'?
+ Ok, I'll do what I can to move things along...
+ Moving things along to the next one...
+ Ok, I'll do what I can to back things up...
+ Ok, backing up.
+ Ok, skipping it along.
+ Let me see what I can do to goto that attack.
+ That was the last one for now. You can rest easy, until next time... (End.)
+ That was the last one. Game over?
+ You are back to the beginning!
+ This is where it all began.
+ Doing my thing...
+ Here we go...
+ ...
+ ....
+ Let me know when you are 'ready', if you want to move on say 'next', or 'previous' and I'll move things along.
+ Say 'ready', 'next', or 'previous'.
+
+
+ I am waiting for you to say 'ready', 'next', 'previous', 'list', 'goto *X*', or 'answer *X*'
+ Say "The answer is *X*".
+ There is no question to answer
+ Correct
+ Incorrect
+ That's not possible.
+ Wouldn't you like to know.
+
+
+ Oh no. Failed to get shell... You need to let us in.
+
+
+
+ Authentication
+ <%= ERB.new(File.read self.templates_path + 'intro.md.erb').result(self.get_binding) %>
+
+
+ true
+
+
+
+
+
+ <% $newuser = "user#{SecureRandom.hex(2)}" -%>
+
+ Add a user to the system, named "<%= $newuser %>".
+ grep <%= $newuser %> /etc/shadow; echo $?
+
+
+ 0
+ :) Well done! <%= $flags.pop %>
+
+
+
+ 1
+ :( It looks like you forgot to create the user?
+
+
+ :( User not found
+
+
+
+
+
+
+ Add the new <%= $newuser %> user to the 'users' group.
+ id <%= $newuser %> | grep users; echo $?
+
+
+ 0
+ :) Well done! <%= $flags.pop %>
+
+
+
+ 1
+ :( It looks like you forgot to add the user to the group?
+
+
+ :( Group not found
+
+
+
+
+
+
+ Crack the passwords of the users on the desktop VM, and use those credentials to SSH to the server, where you will find flags (ssh username@<%= $server_ip %> for each username you crack the password for.) This is the end.
+
+
+ .*
+ :)
+
+
+
+ .*
+ :)
+
+
+
+ :)
+
+
+
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/labsheet.html.erb b/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/labsheet.html.erb
new file mode 100644
index 000000000..0bb7cc90a
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/labsheet.html.erb
@@ -0,0 +1,114 @@
+
+
+ <%= self.title %>
+
+
+
+
+
+
+ <%= self.html_TOC_rendered %>
+
+
+
+ <%= self.html_rendered %>
+
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/license.md.erb b/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/license.md.erb
new file mode 100644
index 000000000..c11478e8e
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/license.md.erb
@@ -0,0 +1,6 @@
+## License
+This lab by [*Z. Cliffe Schreuders*](http://z.cliffe.schreuders.org) at Leeds Beckett University is licensed under a [*Creative Commons Attribution-ShareAlike 3.0 Unported License*](http://creativecommons.org/licenses/by-sa/3.0/deed.en_GB).
+
+Included software source code is also licensed under the GNU General Public License, either version 3 of the License, or (at your option) any later version.
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/resources.md.erb b/modules/generators/structured_content/hackerbot_config/hbauthentication/templates/resources.md.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/structured_content/hackerbot_config/integrity_protection/secgen_metadata.xml b/modules/generators/structured_content/hackerbot_config/integrity_protection/secgen_metadata.xml
index a748298ff..bb040ff7e 100644
--- a/modules/generators/structured_content/hackerbot_config/integrity_protection/secgen_metadata.xml
+++ b/modules/generators/structured_content/hackerbot_config/integrity_protection/secgen_metadata.xml
@@ -29,10 +29,7 @@
-
-
-
-
+
@@ -41,4 +38,4 @@
hackerbot
-
\ No newline at end of file
+
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_forensic/kali_forensic.pp b/modules/utilities/unix/attack_tools/kali_metapackages/kali_forensic/kali_forensic.pp
new file mode 100644
index 000000000..b84aee99a
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_forensic/kali_forensic.pp
@@ -0,0 +1 @@
+include kali_forensic::install
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_forensic/manifests/install.pp b/modules/utilities/unix/attack_tools/kali_metapackages/kali_forensic/manifests/install.pp
new file mode 100644
index 000000000..d7f7ed569
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_forensic/manifests/install.pp
@@ -0,0 +1,5 @@
+class kali_forensic::install{
+ package { ['kali-linux-forensic']:
+ ensure => 'installed',
+ }
+}
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_forensic/secgen_metadata.xml b/modules/utilities/unix/attack_tools/kali_metapackages/kali_forensic/secgen_metadata.xml
new file mode 100644
index 000000000..c3ec2b3ff
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_forensic/secgen_metadata.xml
@@ -0,0 +1,25 @@
+
+
+
+ Kali Linux Metapackage: kali-linux-forensic
+ Z. Cliffe Schreuders
+ GPLv3
+ Installs a collection of software onto Kali.
+ kali-linux-forensic
+ If you are doing forensics work, you don’t want your analysis system to contain a bunch of unnecessary tools. To the rescue comes the kali-linux-forensic metapackage, which only contains the forensics tools in Kali.
+ Installation Size: 3.1 GB
+
+ attack_tools
+ linux
+
+
+ Kali Light.*
+ attack
+ desktop
+
+
+ update
+
+
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_full/kali_full.pp b/modules/utilities/unix/attack_tools/kali_metapackages/kali_full/kali_full.pp
new file mode 100644
index 000000000..f21676bc1
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_full/kali_full.pp
@@ -0,0 +1 @@
+include kali_full::install
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_full/manifests/install.pp b/modules/utilities/unix/attack_tools/kali_metapackages/kali_full/manifests/install.pp
new file mode 100644
index 000000000..dfb110de6
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_full/manifests/install.pp
@@ -0,0 +1,5 @@
+class kali_full::install{
+ package { ['kali-linux-full']:
+ ensure => 'installed',
+ }
+}
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_full/secgen_metadata.xml b/modules/utilities/unix/attack_tools/kali_metapackages/kali_full/secgen_metadata.xml
new file mode 100644
index 000000000..aad49a1ea
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_full/secgen_metadata.xml
@@ -0,0 +1,25 @@
+
+
+
+ Kali Linux Metapackage: kali-linux-full
+ Z. Cliffe Schreuders
+ GPLv3
+ Installs a collection of software onto Kali.
+ kali-linux-full
+ When you download a Kali Linux ISO, you are essentially downloading an installation that has the kali-linux-full metapackage installed. This package includes all of the tools you are familiar with in Kali.
+ Installation Size: 9.0 GB
+
+ attack_tools
+ linux
+
+
+ Kali Light.*
+ attack
+ desktop
+
+
+ update
+
+
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_pwtools/kali_pwtools.pp b/modules/utilities/unix/attack_tools/kali_metapackages/kali_pwtools/kali_pwtools.pp
new file mode 100644
index 000000000..9c6c591e5
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_pwtools/kali_pwtools.pp
@@ -0,0 +1 @@
+include kali_pwtools::install
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_pwtools/manifests/install.pp b/modules/utilities/unix/attack_tools/kali_metapackages/kali_pwtools/manifests/install.pp
new file mode 100644
index 000000000..cfdc535fa
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_pwtools/manifests/install.pp
@@ -0,0 +1,5 @@
+class kali_pwtools::install{
+ package { ['kali-linux-pwtools']:
+ ensure => 'installed',
+ }
+}
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_pwtools/secgen_metadata.xml b/modules/utilities/unix/attack_tools/kali_metapackages/kali_pwtools/secgen_metadata.xml
new file mode 100644
index 000000000..204aab2b0
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_pwtools/secgen_metadata.xml
@@ -0,0 +1,25 @@
+
+
+
+ Kali Linux Metapackage: kali-linux-pwtools
+ Z. Cliffe Schreuders
+ GPLv3
+ Installs a collection of software onto Kali.
+ kali-linux-pwtools
+ The kali-linux-pwtools metapackage contains over 40 different password cracking utilities as well as the GPU tools contained in kali-linux-gpu.
+ Installation Size: 6.0 GB
+
+ attack_tools
+ linux
+
+
+ Kali Light.*
+ attack
+ desktop
+
+
+ update
+
+
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_top10/kali_top10.pp b/modules/utilities/unix/attack_tools/kali_metapackages/kali_top10/kali_top10.pp
new file mode 100644
index 000000000..2bf2404df
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_top10/kali_top10.pp
@@ -0,0 +1 @@
+include kali_top10::install
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_top10/manifests/install.pp b/modules/utilities/unix/attack_tools/kali_metapackages/kali_top10/manifests/install.pp
new file mode 100644
index 000000000..b45b4a3d4
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_top10/manifests/install.pp
@@ -0,0 +1,5 @@
+class kali_top10::install{
+ package { ['kali-linux-top10']:
+ ensure => 'installed',
+ }
+}
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_top10/secgen_metadata.xml b/modules/utilities/unix/attack_tools/kali_metapackages/kali_top10/secgen_metadata.xml
new file mode 100644
index 000000000..bac3c97b4
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_top10/secgen_metadata.xml
@@ -0,0 +1,25 @@
+
+
+
+ Kali Linux Metapackage: kali-linux-top10
+ Z. Cliffe Schreuders
+ GPLv3
+ Installs a collection of software onto Kali.
+ kali-linux-top10
+ In Kali Linux, we have a sub-menu called “Top 10 Security Tools”. The kali-linux-top10 metapackage will install all of these tools for you in one fell swoop.
+ Installation Size: 3.5 GB
+
+ attack_tools
+ linux
+
+
+ Kali Light.*
+ attack
+ desktop
+
+
+ update
+
+
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_web/kali_web.pp b/modules/utilities/unix/attack_tools/kali_metapackages/kali_web/kali_web.pp
new file mode 100644
index 000000000..00df4deed
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_web/kali_web.pp
@@ -0,0 +1 @@
+include kali_web::install
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_web/manifests/install.pp b/modules/utilities/unix/attack_tools/kali_metapackages/kali_web/manifests/install.pp
new file mode 100644
index 000000000..9b0c523c2
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_web/manifests/install.pp
@@ -0,0 +1,5 @@
+class kali_web::install{
+ package { ['kali-linux-web']:
+ ensure => 'installed',
+ }
+}
diff --git a/modules/utilities/unix/attack_tools/kali_metapackages/kali_web/secgen_metadata.xml b/modules/utilities/unix/attack_tools/kali_metapackages/kali_web/secgen_metadata.xml
new file mode 100644
index 000000000..62a788d0a
--- /dev/null
+++ b/modules/utilities/unix/attack_tools/kali_metapackages/kali_web/secgen_metadata.xml
@@ -0,0 +1,25 @@
+
+
+
+ Kali Linux Metapackage: kali-linux-web
+ Z. Cliffe Schreuders
+ GPLv3
+ Installs a collection of software onto Kali.
+ kali-linux-web
+ Web application assessments are very common in the field of penetration testing and for this reason, Kali includes the kali-linux-web metapackage containing dozens of tools related to web application hacking.
+ Installation Size: 4.9 GB
+
+ attack_tools
+ linux
+
+
+ Kali Light.*
+ attack
+ desktop
+
+
+ update
+
+
diff --git a/modules/utilities/unix/labtainers/files/labtainer.files/trunk/setup_scripts/install-docker-debian.sh b/modules/utilities/unix/labtainers/files/labtainer.files/trunk/setup_scripts/install-docker-debian.sh
new file mode 100755
index 000000000..261e410ea
--- /dev/null
+++ b/modules/utilities/unix/labtainers/files/labtainer.files/trunk/setup_scripts/install-docker-debian.sh
@@ -0,0 +1,90 @@
+#!/bin/bash
+: <<'END'
+This software was created by United States Government employees at
+The Center for the Information Systems Studies and Research (CISR)
+at the Naval Postgraduate School NPS. Please note that within the
+United States, copyright protection is not available for any works
+created by United States Government employees, pursuant to Title 17
+United States Code Section 105. This software is in the public
+domain and is not subject to copyright.
+END
+#
+#Install Docker on a Debian system, along with other packages required by Labtainers
+#
+type sudo >/dev/null 2>&1 || { echo >&2 "Please install sudo. Aborting."; exit 1; }
+sudo -v || { echo >&2 "Please make sure user is sudoer. Aborting."; exit 1; }
+#needed packages for Docker install
+sudo apt-get update
+sudo apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
+
+#adds Docker�s official GPG Key
+curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
+
+#used to verify matching Key ID (optional)
+#sudo apt-key fingerprint 0EBFCD88
+
+#sets up stable repository
+sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
+
+#installs Docker:Community Edition
+sudo apt-get update
+# SecGen change: repo is unauthenticated
+sudo apt-get -y --allow-unauthenticated install docker-ce
+
+#gives user access to docker commands
+sudo groupadd docker
+sudo usermod -aG docker $USER
+
+#enables and starts docker
+sudo systemctl start docker
+sudo systemctl enable docker
+
+#additional packages needed for labtainers
+sudo apt-get -y install python-pip
+sudo pip install --upgrade pip
+sudo pip install netaddr parse python-dateutil
+sudo apt-get -y install openssh-server
+
+#---Checking if packages have been installed. If not, the system will not reboot and allow the user to investigate.
+declare -a packagelist=("apt-transport-https" "ca-certificates" "curl" "gnupg2" "software-properties-common" "docker-ce" "python-pip" "openssh-server")
+packagefail="false"
+
+for i in "${packagelist[@]}"
+do
+#echo $i
+packagecheck=$(dpkg -s $i 2> /dev/null | grep Status)
+#echo $packagecheck
+ if [ "$packagecheck" != "Status: install ok installed" ]; then
+ if [ $i = docker-ce ];then
+ echo "ERROR: '$i' package did not install properly. Please check the terminal output above for any errors related to the pacakge installation. Run the install script two more times. If the issue persists, go to docker docs and follow the instructions for installing docker. (Make sure the instructions is CE and is for your Linux distribution,e.g., Ubuntu and Fedora.)"
+ else
+ echo "ERROR: '$i' package did not install properly. Please check the terminal output above for any errors related to the pacakge installation. Try installing the '$i' package individually by executing this in the command line: 'sudo apt-get install $i"
+ fi
+ packagefail="true"
+ #echo $packagefail
+ fi
+done
+
+pipcheck=$(pip list 2> /dev/null | grep -F netaddr)
+#echo $pipcheck
+if [ -z "$pipcheck" ]; then
+ echo "ERROR: 'netaddr' package did not install properly. Please check the terminal output for any errors related to the pacakge installation. Make sure 'python-pip' is installed and then try running this command: 'sudo -H pip install netaddr' "
+ packagefail="true"
+ #echo $packagefail
+fi
+
+pipcheck=$(pip list 2> /dev/null | grep -F parse)
+#echo $pipcheck
+if [ -z "$pipcheck" ]; then
+ echo "ERROR: 'parse' package did not install properly. Please check the terminal output for any errors related to the package installation. Make sure 'python-pip' is installed and then try running this command: 'sudo -H pip install parse' "
+ packagefail="true"
+ #echo $packagefail
+fi
+
+if [ $packagefail = "true" ]; then
+ exit 1
+fi
+
+exit 0
+
+#Notes: The �-y� after each install means that the user doesn�t need to press �y� in between each package download. The install script is based on this page: https://docs.docker.com/engine/installation/linux/docker-ce/debian/
diff --git a/modules/utilities/unix/labtainers/manifests/config.pp b/modules/utilities/unix/labtainers/manifests/config.pp
new file mode 100644
index 000000000..dfb24ddb1
--- /dev/null
+++ b/modules/utilities/unix/labtainers/manifests/config.pp
@@ -0,0 +1,12 @@
+class labtainers::config{
+ require labtainers::install
+
+ $secgen_parameters = secgen_functions::get_parameters($::base64_inputs_file)
+ $lab = $secgen_parameters['lab'][0]
+
+ exec { 'start lab':
+ command => "/opt/labtainers/labtainer-student/labtainer $lab",
+ provider => shell,
+ }
+
+}
diff --git a/modules/utilities/unix/labtainers/manifests/install.pp b/modules/utilities/unix/labtainers/manifests/install.pp
new file mode 100644
index 000000000..c140d6ea6
--- /dev/null
+++ b/modules/utilities/unix/labtainers/manifests/install.pp
@@ -0,0 +1,27 @@
+class labtainers::install{
+ # $json_inputs = base64('decode', $::base64_inputs)
+ # $secgen_parameters = parsejson($json_inputs)
+ # $server_ip = $secgen_parameters['server_ip'][0]
+ # $port = $secgen_parameters['port'][0]
+
+
+ # these are also installed by the install script, but good to use puppet where possible
+ package { ['apt-transport-https', 'ca-certificates', 'curl', 'gnupg2', 'software-properties-common', 'python-pip', 'openssh-server']:
+ ensure => 'installed',
+ } ->
+
+ file { '/opt/labtainers':
+ ensure => directory,
+ recurse => true,
+ source => 'puppet:///modules/labtainers/labtainer.files',
+ mode => '0766',
+ owner => 'root',
+ group => 'root',
+ } ->
+
+ exec { 'install script':
+ command => '/opt/labtainers/install-labtainer.sh',
+ provider => shell,
+ }
+
+}
diff --git a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/.gitignore b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/.gitignore
index 319a2c383..723dba7b5 100644
--- a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/.gitignore
+++ b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/.gitignore
@@ -1,2 +1,5 @@
config/config.inc.php
-Dockerfile
\ No newline at end of file
+Dockerfile
+
+# Vim swap files
+.*swp
diff --git a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/README.md b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/README.md
index 9c90823db..4908c787d 100644
--- a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/README.md
+++ b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/README.md
@@ -12,7 +12,7 @@ Damn Vulnerable Web Application is damn vulnerable! **Do not upload it to your h
### Disclaimer
-We do not take responsibility for the way in which any one uses this application (DVWA). We have made the purposes of the application clear and it should not be used maliciously. We have given warnings and taken measures to prevent users from installing DVWA on to live web servers. If your web server is compromised via an installation of DVWA it is not our responsibility it is the responsibility of the person/s who uploaded and installed it.
+We do not take responsibility for the way in which any one uses this application (DVWA). We have made the purposes of the application clear and it should not be used maliciously. We have given warnings and taken measures to prevent users from installing DVWA on to live web servers. If your web server is compromised via an installation of DVWA, it is not our responsibility, it is the responsibility of the person/s who uploaded and installed it.
- - -
@@ -37,8 +37,8 @@ along with Damn Vulnerable Web Application (DVWA). If not, see http://www.gnu.o
## Download and install as a docker container
- [dockerhub page](https://hub.docker.com/r/vulnerables/web-dvwa/)
`docker run --rm -it -p 80:80 vulnerables/web-dvwa`
-
-Please ensure you are using aufs due to previous MySQL issues. Run `docker info` to check your storage driver. If it isn't aufs, please change it as such. There are guides for each operating system on how to do that, but they're quite different so we won't cover that here.
+
+Please ensure you are using aufs due to previous MySQL issues. Run `docker info` to check your storage driver. If it isn't aufs, please change it as such. There are guides for each operating system on how to do that, but they're quite different so we won't cover that here.
## Download
@@ -74,7 +74,7 @@ Simply unzip dvwa.zip, place the unzipped files in your public html folder, then
If you are using a Debian based Linux distribution, you will need to install the following packages _(or their equivalent)_:
-`apt-get -y install apache2 mysql-server php php-mysqli php-gd libapache2-mod-php`
+`apt-get -y install apache2 mysql-server php php-mysqli php-gd libapache2-mod-php`
### Database Setup
@@ -84,30 +84,36 @@ If you receive an error while trying to create your database, make sure your dat
The variables are set to the following by default:
-```php
+```php
$_DVWA[ 'db_user' ] = 'root';
$_DVWA[ 'db_password' ] = 'p@ssw0rd';
$_DVWA[ 'db_database' ] = 'dvwa';
-```
-
-Note, if you are using MariaDB rather than MySQL (MariaDB is default in Kali), then you can't use the database root user, you must create a new database user. To do this, connect to the database as the root user then use the following commands:
-
-```mysql
-mysql> create database dvwa;
-Query OK, 1 row affected (0.00 sec)
-
-mysql> grant all on dvwa.* to dvwa@localhost identified by 'xxx';
-Query OK, 0 rows affected, 1 warning (0.01 sec)
-
-mysql> flush privileges;
-Query OK, 0 rows affected (0.00 sec)
-
-
-```
-
+```
+
+Note, if you are using MariaDB rather than MySQL (MariaDB is default in Kali), then you can't use the database root user, you must create a new database user. To do this, connect to the database as the root user then use the following commands:
+
+```mysql
+mysql> create database dvwa;
+Query OK, 1 row affected (0.00 sec)
+
+mysql> grant all on dvwa.* to dvwa@localhost identified by 'SuperSecretPassword99';
+Query OK, 0 rows affected, 1 warning (0.01 sec)
+
+mysql> flush privileges;
+Query OK, 0 rows affected (0.00 sec)
+```
+
+You will then need to update the config file, the new entries will look like this:
+
+```php
+$_DVWA[ 'db_user' ] = 'dvwa';
+$_DVWA[ 'db_password' ] = 'SuperSecretPassword99';
+$_DVWA[ 'db_database' ] = 'dvwa';
+```
+
### Other Configuration
-Depending on your Operating System as well as version of PHP, you may wish to alter the default configuration. The location of the files will be different on a per-machine basis.
+Depending on your Operating System, as well as version of PHP, you may wish to alter the default configuration. The location of the files will be different on a per-machine basis.
**Folder Permissions**:
@@ -143,7 +149,7 @@ https://github.com/ethicalhack3r/DVWA/issues
+Q. SQL Injection won't work on PHP v5.2.6.
--A.If you are using PHP v5.2.6 or above you will need to do the following in order for SQL injection and other vulnerabilities to work.
+-A.If you are using PHP v5.2.6 or above, you will need to do the following in order for SQL injection and other vulnerabilities to work.
In `.htaccess`:
@@ -171,6 +177,12 @@ With:
-A. Apache may not have high enough privileges to run commands on the web server. If you are running DVWA under Linux make sure you are logged in as root. Under Windows log in as Administrator.
++Q. Why can't the database connect on CentOS?
+
+-A. You may be running into problems with SELinux. Either disable SELinux or run this command to allow the webserver to talk to the database:
+```
+setsebool -P httpd_can_network_connect_db 1
+```
- - -
diff --git a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/config/config.inc.php.dist b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/config/config.inc.php.dist
index a03dd25fd..41d9ce582 100644
--- a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/config/config.inc.php.dist
+++ b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/config/config.inc.php.dist
@@ -25,7 +25,7 @@ $_DVWA[ 'db_port '] = '5432';
# ReCAPTCHA settings
# Used for the 'Insecure CAPTCHA' module
-# You'll need to generate your own keys at: https://www.google.com/recaptcha/admin/create
+# You'll need to generate your own keys at: https://www.google.com/recaptcha/admin
$_DVWA[ 'recaptcha_public_key' ] = '';
$_DVWA[ 'recaptcha_private_key' ] = '';
diff --git a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/dvwa/includes/DBMS/MySQL.php b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/dvwa/includes/DBMS/MySQL.php
index 3af6617eb..c39061288 100644
--- a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/dvwa/includes/DBMS/MySQL.php
+++ b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/dvwa/includes/DBMS/MySQL.php
@@ -47,17 +47,14 @@ dvwaMessagePush( "'users' table was created." );
// Insert some data into users
-// Get the base directory for the avatar media...
-$baseUrl = 'http://' . $_SERVER[ 'SERVER_NAME' ] . $_SERVER[ 'PHP_SELF' ];
-$stripPos = strpos( $baseUrl, 'setup.php' );
-$baseUrl = substr( $baseUrl, 0, $stripPos ) . 'hackable/users/';
+$avatarUrl = '/hackable/users/';
$insert = "INSERT INTO users VALUES
- ('1','admin','admin','admin',MD5('password'),'{$baseUrl}admin.jpg', NOW(), '0'),
- ('2','Gordon','Brown','gordonb',MD5('abc123'),'{$baseUrl}gordonb.jpg', NOW(), '0'),
- ('3','Hack','Me','1337',MD5('charley'),'{$baseUrl}1337.jpg', NOW(), '0'),
- ('4','Pablo','Picasso','pablo',MD5('letmein'),'{$baseUrl}pablo.jpg', NOW(), '0'),
- ('5','Bob','Smith','smithy',MD5('password'),'{$baseUrl}smithy.jpg', NOW(), '0');";
+ ('1','admin','admin','admin',MD5('password'),'{$avatarUrl}admin.jpg', NOW(), '0'),
+ ('2','Gordon','Brown','gordonb',MD5('abc123'),'{$avatarUrl}gordonb.jpg', NOW(), '0'),
+ ('3','Hack','Me','1337',MD5('charley'),'{$avatarUrl}1337.jpg', NOW(), '0'),
+ ('4','Pablo','Picasso','pablo',MD5('letmein'),'{$avatarUrl}pablo.jpg', NOW(), '0'),
+ ('5','Bob','Smith','smithy',MD5('password'),'{$avatarUrl}smithy.jpg', NOW(), '0');";
if( !mysqli_query($GLOBALS["___mysqli_ston"], $insert ) ) {
dvwaMessagePush( "Data could not be inserted into 'users' table SQL: " . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) );
dvwaPageReload();
diff --git a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/dvwa/includes/dvwaPage.inc.php b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/dvwa/includes/dvwaPage.inc.php
index 114e7fd49..2ded275de 100644
--- a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/dvwa/includes/dvwaPage.inc.php
+++ b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/dvwa/includes/dvwaPage.inc.php
@@ -208,6 +208,8 @@ function dvwaHtmlEcho( $pPage ) {
$menuBlocks[ 'vulnerabilities' ][] = array( 'id' => 'xss_d', 'name' => 'XSS (DOM)', 'url' => 'vulnerabilities/xss_d/' );
$menuBlocks[ 'vulnerabilities' ][] = array( 'id' => 'xss_r', 'name' => 'XSS (Reflected)', 'url' => 'vulnerabilities/xss_r/' );
$menuBlocks[ 'vulnerabilities' ][] = array( 'id' => 'xss_s', 'name' => 'XSS (Stored)', 'url' => 'vulnerabilities/xss_s/' );
+ $menuBlocks[ 'vulnerabilities' ][] = array( 'id' => 'csp', 'name' => 'CSP Bypass', 'url' => 'vulnerabilities/csp/' );
+ $menuBlocks[ 'vulnerabilities' ][] = array( 'id' => 'javascript', 'name' => 'JavaScript', 'url' => 'vulnerabilities/javascript/' );
}
$menuBlocks[ 'meta' ] = array();
@@ -229,7 +231,7 @@ function dvwaHtmlEcho( $pPage ) {
foreach( $menuBlock as $menuItem ) {
$selectedClass = ( $menuItem[ 'id' ] == $pPage[ 'page_id' ] ) ? 'selected' : '';
$fixedUrl = DVWA_WEB_PAGE_TO_ROOT.$menuItem[ 'url' ];
- $menuBlockHtml .= "
A is a program that can tell whether its user is a human or a computer. You've probably seen
+
A is a program that can tell whether its user is a human or a computer. You've probably seen
them - colourful images with distorted text at the bottom of Web registration forms. CAPTCHAs are used by many websites to prevent abuse from
"bots", or automated programs usually written to generate spam. No computer program can read distorted text as well as humans can, so bots
cannot navigate sites protected by CAPTCHAs.
Content Security Policy (CSP) is used to define where scripts and other resources can be loaded or executed from. This module will walk you through ways to bypass the policy based on common mistakes made by developers.
+
None of the vulnerabilities are actual vulnerabilities in CSP, they are vulnerabilities in the way it has been implemented.
+
+
+
+
Objective
+
Bypass Content Security Policy (CSP) and execute JavaScript in the page.
+
+
+
+
Low Level
+
Examine the policy to find all the sources that can be used to host external script files.
+
Spoiler: Scripts can be included from Pastebin, try storing some JavaScript on there and then loading it in.
+
+
+
+
Medium Level
+
The CSP policy tries to use a nonce to prevent inline scripts from being added by attackers.
+
Spoiler: Examine the nonce and see how it varies (or doesn't).
+
+
+
+
High Level
+
The page makes a JSONP call to source/jsonp.php passing the name of the function to callback to, you need to modify the jsonp.php script to change the callback function.
+
Spoiler: The JavaScript on the page will execute whatever is returned by the page, changing this to your own code will execute that instead
+
+
+
+
Impossible Level
+
+ This level is an update of the high level where the JSONP call has its callback function hardcoded and the CSP policy is locked down to only allow external scripts.
+
+
+
+
+
+
+
+
+
+
Reference:
+
Reference:
+
Reference:
+
diff --git a/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/vulnerabilities/csp/index.php b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/vulnerabilities/csp/index.php
new file mode 100644
index 000000000..aa189ff07
--- /dev/null
+++ b/modules/vulnerabilities/unix/web_training/dvwa/files/DVWA-master/vulnerabilities/csp/index.php
@@ -0,0 +1,57 @@
+
+
" . dvwaExternalLinkUrlGet( 'https://blog.mozilla.org/security/2014/10/04/csp-for-the-web-we-have/', "Mozilla Security Blog - CSP for the web we have" ) . "
The attacks in this section are designed to help you learn about how JavaScript is used in the browser and how it can be manipulated. The attacks could be carried out by just analysing network traffic, but that isn't the point and it would also probably be a lot harder.
+
+
+
+
Objective
+
Simply submit the phrase "success" to win the level. Obviously, it isn't quite that easy, each level implements different protection mechanisms, the JavaScript included in the pages has to be analysed and then manipulated to bypass the protections.
+
+
+
Low Level
+
All the JavaScript is included in the page. Read the source and work out what function is being used to generate the token required to match with the phrase and then call the function manually.
+
Spoiler: Change the phrase to success and then use the function generate_token() to update the token.
+
+
+
+
Medium Level
+
+ The JavaScript has been broken out into its own file and then minimized. You need to view the source for the included file and then work out what it is doing. Both Firefox and Chrome have a Pretty Print feature which attempts to reverse the compression and display code in a readable way.
+
+
Spoiler: The file uses the setTimeout function to run the do_elsesomething function which generates the token.
+
+
+
+
High Level
+
+ The JavaScript has been obfuscated by at least one engine. You are going to need to step through the code to work out what is useful, what is garbage and what is needed to complete the mission.
+
Spoiler 2: This deobfuscation tool seems to work the best on this code deobfuscate javascript.
+
Spoiler 3: This is one way to do it... run the obfuscated JS through a deobfuscation app, intercept the response for the obfuscated JS and swap in the readable version. Work out the flow and you will see three functions that need to be called in order. Call the functions at the right time with the right parameters.
+
+
+
+
Impossible Level
+
You can never trust the user and have to assume that any code sent to the user can be manipulated or bypassed and so there is no impossible level.