converted the static parameterised_website into a very vulnerable php app.

This commit is contained in:
thomashaw
2026-02-07 16:24:04 +00:00
parent c8010035a9
commit af5136d4cc
44 changed files with 36764 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
$( function() {
$( "#tabs" ).tabs({
beforeLoad: function( event, ui ) {
ui.jqXHR.fail(function() {
ui.panel.html(
"Couldn't load this tab. We'll try to fix this as soon as possible. " );
});
}
});
} );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
#!/bin/sh
USERNAME=${1}
PASSWORD=${2}
echo "GRANT ALL PRIVILEGES ON * . * TO '${USERNAME}'@'localhost';"| mysql --force
echo "CREATE DATABASE db;"| mysql --user=${USERNAME} --password=${PASSWORD} --force
mysql --force --user=${USERNAME} --password=${PASSWORD} db < ./db.sql

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
class vuln_parameterised_website::apache {
$secgen_parameters = secgen_functions::get_parameters($::base64_inputs_file)
$port = $secgen_parameters['port'][0]
package { ['php', 'php-gd', 'libapache2-mod-php', 'php-mysql']:
ensure => installed,
}
class { '::apache':
default_vhost => false,
overwrite_ports => false,
mpm_module => 'prefork',
}
apache::vhost { 'parameterised.website':
port => $port,
docroot => '/var/www/vuln_parameterised_website',
notify => Tidy['pws remove default site'],
}
ensure_resource('tidy','pws remove default site', {'path'=>'/etc/apache2/sites-enabled/000-default.conf'})
}

View File

@@ -0,0 +1,53 @@
class vuln_parameterised_website::db_setup {
$secgen_parameters = secgen_functions::get_parameters($::base64_inputs_file)
$db_username = $secgen_parameters['db_username'][0]
$db_password = $secgen_parameters['db_password'][0]
$raw_org = $secgen_parameters['organisation'][0]
if $raw_org and $raw_org != '' {
$organisation = parsejson($raw_org)
}
if $organisation and $organisation != '' {
$manager_profile = $organisation['manager']
$employees = $organisation['employees']
} else {
$manager_profile = ''
$employees = []
}
mysql_user{ "$db_username@localhost":
ensure => present,
password_hash => mysql_password($db_password)
}
# Table setup file, setting the template
file { "/tmp/db.sql":
owner => root,
group => root,
mode => '0600',
ensure => file,
content => template('vuln_parameterised_website/db.sql.erb'),
notify => File["/tmp/mysql_setup.sh"],
}
# Moving across the shell script which setups the database
file { "/tmp/mysql_setup.sh":
owner => root,
group => root,
mode => '0700',
ensure => file,
source => 'puppet:///modules/vuln_parameterised_website/mysql_setup.sh',
notify => Exec['setup_mysql'],
}
# Execute the shell script with the specifed username and password
exec { 'setup_mysql':
cwd => "/tmp",
command => "sudo ./mysql_setup.sh $db_username $db_password",
path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ],
}
}

View File

@@ -0,0 +1,242 @@
class vuln_parameterised_website::install {
$secgen_parameters = secgen_functions::get_parameters($::base64_inputs_file)
$theme = $secgen_parameters['theme'][0]
$raw_org = $secgen_parameters['organisation'][0]
if $raw_org and $raw_org != '' {
$organisation = parsejson($raw_org)
}
if $organisation and $organisation != '' {
$business_name = $organisation['business_name']
$business_motto = $organisation['business_motto']
$manager_profile = $organisation['manager']
$business_address = $organisation['business_address']
$office_telephone = $organisation['office_telephone']
$office_email = $organisation['office_email']
$industry = $organisation['industry']
$product_name = $organisation['product_name']
$employees = $organisation['employees']
$intro_paragraph = $organisation['intro_paragraph']
} else {
$business_name = ''
$business_motto = ''
$manager_profile = ''
$business_address = ''
$office_telephone = ''
$office_email = ''
$industry = ''
$product_name = ''
$employees = []
$intro_paragraph = []
}
$strings_to_leak = $secgen_parameters['strings_to_leak']
$images_to_leak = $secgen_parameters['images_to_leak']
$images_mode = $secgen_parameters['images_mode']
$security_audit = $secgen_parameters['security_audit']
$acceptable_use_policy = str2bool($secgen_parameters['host_acceptable_use_policy'][0])
$visible_tabs = $secgen_parameters['visible_tabs']
$hidden_tabs = $secgen_parameters['hidden_tabs']
$white_text = $secgen_parameters['white_text']
$db_username = $secgen_parameters['db_username'][0]
$db_password = $secgen_parameters['db_password'][0]
if $intro_paragraph != [] and $intro_paragraph != '' {
$main_page_paragraph_content = $intro_paragraph
} else {
$main_page_paragraph_content = $secgen_parameters['main_page_paragraph_content']
}
# Additional Pages
$additional_pages = $secgen_parameters['additional_pages']
$additional_page_filenames = $secgen_parameters['additional_page_filenames']
$docroot = '/var/www/vuln_parameterised_website'
if $acceptable_use_policy { # Use alternative intranet index.php template
$index_template = 'vuln_parameterised_website/intranet_index.php.erb'
} else {
$index_template = 'vuln_parameterised_website/index.php.erb'
}
file { $docroot:
ensure => directory,
}
# Move boostrap css+js over
file { "$docroot/css":
ensure => directory,
recurse => true,
source => 'puppet:///modules/vuln_parameterised_website/css',
require => File[$docroot],
}
file { "$docroot/js":
ensure => directory,
recurse => true,
source => 'puppet:///modules/vuln_parameterised_website/js',
require => File[$docroot],
}
# Apply default CSS template
file { "$docroot/css/default.css":
ensure => file,
content => template('vuln_parameterised_website/default.css.erb'),
require => File["$docroot/css"],
}
# Add randomly selected CSS theme
file { "$docroot/css/$theme":
ensure => file,
source => "puppet:///modules/vuln_parameterised_website/themes/$theme",
require => File[$docroot],
}
# Apply index page template
file { "$docroot/index.php":
ensure => file,
content => template($index_template),
require => File[$docroot],
}
if $organisation and $organisation != ''{
# Apply contact page template
file { "$docroot/contact.php":
ensure => file,
content => template('vuln_parameterised_website/contact.php.erb'),
}
}
# Create visible tab html files
unless $visible_tabs == undef {
$visible_tabs.each |$counter, $visible_tab| {
if $counter != 0 {
$n = $counter
file { "$docroot/tab_$n.php":
ensure => file,
content => $visible_tab,
}
}
}
}
# Create hidden tab html files
unless $hidden_tabs == undef {
$hidden_tabs.each |$counter, $hidden_tab| {
if $counter == 0 {
$n = 0
} else {
$n = $counter + $visible_tabs.length - 1 # minus one accounts for the information tab
}
file { "$docroot/tab_$n.php":
ensure => file,
content => $hidden_tab,
}
}
}
if $images_to_leak {
if $images_mode {
::secgen_functions::leak_files { 'vuln-parameterised_website-image-leak-mode':
storage_directory => $docroot,
images_to_leak => $images_to_leak,
mode => $images_mode,
leaked_from => "vuln_parameterised_website",
}
} else {
::secgen_functions::leak_files { 'vuln-parameterised_website-image-leak':
storage_directory => $docroot,
images_to_leak => $images_to_leak,
leaked_from => "vuln_parameterised_website",
}
}
}
if $additional_pages and $additional_page_filenames {
$additional_page_pairs = zip($additional_pages, $additional_page_filenames)
$additional_page_pairs.each |$additional_page_pair|{
$additional_page_contents = $additional_page_pair[0]
$additional_page_filename = $additional_page_pair[1]
file { "$docroot/$additional_page_filename":
ensure => file,
content => template('vuln_parameterised_website/page.php.erb'),
}
}
}
if $acceptable_use_policy {
# Apply template
file{ "$docroot/acceptable_use_policy.html":
ensure => file,
content => template('vuln_parameterised_website/acceptable_use_page.php.erb')
}
}
# Security audit remit
if $security_audit {
$security_audit_remit = $security_audit[0]
# Apply template
file{ "$docroot/security_audit_remit.html":
ensure => file,
content => template('vuln_parameterised_website/security_audit_remit_page.php.erb'),
}
}
file { "$docroot/config.php":
ensure => file,
content => template('vuln_parameterised_website/config.php.erb'),
}
# Login page
file { "$docroot/login.php":
ensure => file,
content => template('vuln_parameterised_website/login.php.erb'),
}
# Login function
file { "$docroot/login_process.php":
ensure => file,
content => template('vuln_parameterised_website/login_process.php.erb'),
}
file { "$docroot/logout.php":
ensure => file,
content => template('vuln_parameterised_website/logout.php.erb'),
}
file { "$docroot/guestbook.php":
ensure => file,
content => template('vuln_parameterised_website/guestbook.php.erb'),
}
file { "$docroot/guestbook_process.php":
ensure => file,
content => template('vuln_parameterised_website/guestbook_process.php.erb'),
}
file { "$docroot/profile.php":
ensure => file,
content => template('vuln_parameterised_website/profile.php.erb'),
}
file { "$docroot/change_password.php.erb":
ensure => file,
content => template('vuln_parameterised_website/change_password.php.erb'),
}
}

View File

@@ -0,0 +1,90 @@
<?xml version="1.0"?>
<vulnerability xmlns="http://www.github/cliffe/SecGen/vulnerability"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.github/cliffe/SecGen/vulnerability">
<name>Random Parameterised Website</name>
<author>Thomas Shaw</author>
<module_license>MIT</module_license>
<description>Vulnerable parameterised webapp filled with generated content.</description>
<type>http</type>
<privilege>user_rwx</privilege>
<access>remote</access>
<platform>linux</platform>
<!-- Strings are leaked in index.html source code comments -->
<read_fact>strings_to_leak</read_fact>
<read_fact>images_to_leak</read_fact>
<read_fact>organisation</read_fact>
<read_fact>main_page_paragraph_content</read_fact>
<read_fact>white_text</read_fact>
<read_fact>additional_pages</read_fact>
<read_fact>additional_page_filenames</read_fact>
<!-- Team Project markers, generate and host an acceptable use policy on a basic website. -->
<read_fact>host_acceptable_use_policy</read_fact>
<read_fact>security_audit</read_fact>
<!-- Tab-pane contents, add some HTML, usually CTF challenges, here. -->
<read_fact>visible_tabs</read_fact>
<read_fact>hidden_tabs</read_fact>
<!-- Allows you to set mode of images_to_leak -->
<read_fact>images_mode</read_fact>
<read_fact>port</read_fact>
<read_fact>theme</read_fact>
<read_fact>db_username</read_fact>
<read_fact>db_password</read_fact>
<default_input into="port">
<value>80</value>
</default_input>
<default_input into="strings_to_leak">
<generator type="message_generator"/>
<generator type="message_generator"/>
</default_input>
<default_input into="organisation">
<generator type="organisation"/>
</default_input>
<default_input into="main_page_paragraph_content">
<generator type="text_paragraph"/>
</default_input>
<default_input into="host_acceptable_use_policy">
<value>false</value>
</default_input>
<default_input into="theme">
<generator type="website_theme"/>
</default_input>
<default_input into="db_username">
<value>user</value>
</default_input>
<default_input into="db_password">
<value>password123</value>
</default_input>
<conflict>
<module_path>.*parameterised_website</module_path>
</conflict>
<requires>
<module_path>.*apache</module_path>
<type>httpd</type>
</requires>
<requires>
<module_path>.*mysql.*compatible.*</module_path>
</requires>
</vulnerability>

View File

@@ -0,0 +1,75 @@
require_relative '../../../../../lib/post_provision_test'
require 'json'
class ParamWebsiteTest < PostProvisionTest
attr_accessor :organisation
def initialize
self.module_name = 'vuln_parameterised_website'
self.module_path = get_module_path(__FILE__)
super
end
def test_module
super
json_inputs = get_json_inputs
test_service_up
test_html_returned_content("/css/#{json_inputs['theme'][0]}", 'Bootswatch v4.0.0')
test_org_functionality(json_inputs)
test_additional_page(json_inputs)
test_security_audit_remit(json_inputs)
test_acceptable_use_policy(json_inputs)
end
def get_organisation(json_inputs)
JSON.parse(json_inputs['organisation'][0])
end
def test_org_functionality(json_inputs)
if json_inputs['organisation'] and
json_inputs['organisation'][0] and
json_inputs['organisation'][0] != ''
organisation = get_organisation(json_inputs)
employee_1 = organisation['employees'][0]
test_html_returned_content('/index.html', organisation['business_name'])
test_html_returned_content('/contact.html', organisation['business_motto'])
test_html_returned_content('/contact.html', employee_1['name'])
end
end
def test_security_audit_remit(json_inputs)
if json_inputs['security_audit'] and
json_inputs['security_audit'][0] and
json_inputs['security_audit'][0] != ''
test_html_returned_content('/security_audit_remit.html', "Security Audit Remit of #{get_organisation(json_inputs)['business_name']}")
end
end
def test_acceptable_use_policy(json_inputs)
if json_inputs['host_acceptable_use_policy'] and
json_inputs['host_acceptable_use_policy'][0] and
json_inputs['host_acceptable_use_policy'][0] == 'true'
test_html_returned_content('/acceptable_use_policy.html', "Acceptable Use Policy")
test_html_returned_content('/acceptable_use_policy.html', get_organisation(json_inputs)['business_name'])
end
end
def test_additional_page(json_inputs)
if json_inputs['additional_page_filenames'] and
json_inputs['additional_page_filenames'][0] and
json_inputs['additional_page_filenames'][0].include? 'html' and
json_inputs['additional_pages'] and
json_inputs['additional_pages'][0]
page_name = json_inputs['additional_page_filenames'][0]
page_name = "/#{page_name}" if page_name.split[0] != '/'
test_html_returned_content(page_name, json_inputs['additional_pages'][0], true)
end
end
end
ParamWebsiteTest.new.run

View File

@@ -0,0 +1,10 @@
<% $current_page = 'Acceptable Use Policy' %>
<?php require_once 'config.php'; ?>
<html>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/header.php.erb']) %>
<body>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/navbar.php.erb']) %>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/acceptable_use_policy.php.erb']) %>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/scripts.php.erb']) %>
</body>
</html>

View File

@@ -0,0 +1,41 @@
<?php require_once 'config.php'; ?>
<?php
// Check if user is logged in
if (!isset($_SESSION['logged_in']) || !$_SESSION['logged_in']) {
header('Location: login.php');
exit();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// INTENTIONALLY VULNERABLE - Uses username from POST instead of session
// This allows CSRF attacks to change other users' passwords
$username = $_POST['username'];
$new_password = $_POST['new_password'];
$confirm_password = $_POST['confirm_password'];
// Check passwords match
if ($new_password !== $confirm_password) {
$_SESSION['password_error'] = 'Passwords do not match!';
header('Location: profile.php');
exit();
}
// INTENTIONALLY VULNERABLE - SQL Injection + no CSRF token
$query = "UPDATE Users SET password = '$new_password' WHERE username = '$username'";
if ($conn->query($query)) {
// Check if it was the logged-in user's password that changed
if ($username === $_SESSION['username']) {
$_SESSION['password_success'] = 'Password changed successfully!';
} else {
// CSRF attack succeeded - changed someone else's password
$_SESSION['password_success'] = 'Password changed for user: ' . htmlspecialchars($username);
}
} else {
$_SESSION['password_error'] = 'Failed to change password.';
}
header('Location: profile.php');
exit();
}
?>

View File

@@ -0,0 +1,18 @@
<?php
// Start session
session_start();
// Database connection
$db_host = 'localhost';
$db_user = '<%= @db_username %>';
$db_pass = '<%= @db_password %>';
$db_name = 'db';
// Create connection
$conn = new mysqli($db_host, $db_user, $db_pass, $db_name);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>

View File

@@ -0,0 +1,50 @@
<% $current_page = 'Contact Us' -%>
<?php require_once 'config.php'; ?>
<html>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/header.php.erb']) %>
<body>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/navbar.php.erb']) %>
<div id="main_container" class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-text">
<h1 class="name"><%= @business_name %></h1>
<hr class="star-light">
<h3> <%= @business_motto %></h3>
</div>
</div>
<div class="col-lg-12" id="contact">
<div>
<h2>Contact <%= @business_name %></h2>
<p>Address: <%= @business_address %></p>
<p>Telephone: <%= @office_telephone %></p>
<p>Email: <%= @office_email %></p>
</div>
</div>
<div class="col-lg-12">
<div class="employee">
<h2>Manager</h2>
<p><%= @manager_profile['name'] %></p>
<p><%= @manager_profile['phone_number'] %></p>
<p><%= @manager_profile['email_address'] %></p>
</div>
</div>
<% if @employees and @employees.length > 0 -%>
<div class="col-lg-12" id="employees">
<h2>Employees</h2>
<% @employees.each do |employee| -%>
<div class="col-lg-4">
<div class="employee">
<p><strong><%= employee['name'] %></strong></p>
<p><%= employee['phone_number'] %></p>
<p><%= employee['email_address'] %></p>
</div>
</div>
<% end %>
</div>
<% end -%>
</div>
</div>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/scripts.php.erb']) %>
</body>
</html>

View File

@@ -0,0 +1,91 @@
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
--
-- Database: `db`
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE Users (
`ID` int(6) NOT NULL,
`name` varchar(100) NOT NULL,
`address` varchar(200) NOT NULL,
`mobile` varchar(100) NOT NULL,
`email` varchar(150) NOT NULL,
`username` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`admin` BOOLEAN NOT NULL DEFAULT FALSE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
<% if @raw_org && !@raw_org.empty? -%>
INSERT INTO Users (`ID`, `name`, `address`, `mobile`, `email`, `username`, `password`, `admin`) VALUES
<% if @manager_profile -%>
(1, '<%= @manager_profile['name'] %>', '<%= @manager_profile['address'] || 'Address not provided' %>', '<%= @manager_profile['phone_number'] %>', '<%= @manager_profile['email_address'] %>', '<%= @manager_profile['username'] %>', '<%= @manager_profile['password'] %>', TRUE)<%= @employees && @employees.length > 0 ? ',' : ';' %>
<% end -%>
<% if @employees && @employees.length > 0 -%>
<% @employees.each_with_index do |employee, index| -%>
(<%= index + 2 %>, '<%= employee['name'] %>', '<%= employee['address'] || 'Address not provided' %>', '<%= employee['phone_number'] %>', '<%= employee['email_address'] %>', '<%= employee['username'] %>', '<%= employee['password'] %>', FALSE)<%= index < @employees.length - 1 ? ',' : ';' %>
<% end -%>
<% end -%>
<% else -%>
INSERT INTO Users (`ID`, `name`, `address`, `mobile`, `email`, `username`, `password`, `admin`) VALUES (1, 'admin', '123 test street', '07123456789', 'user@test.com', 'user', 'password123', TRUE);
<% end -%>
--
-- Indexes for dumped tables
--
--
-- Indexes for table `users`
--
ALTER TABLE Users ADD PRIMARY KEY (`ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE Users
MODIFY `ID` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
--
-- Table structure for table `guestbook`
--
CREATE TABLE `guestbook` (
`id` int(6) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`message` text NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `guestbook`
--
INSERT INTO `guestbook` (`name`, `message`) VALUES
('Alice', 'Great website! Looking forward to more content.'),
('Bob', 'Thanks for creating this resource.'),
('Charlie', 'Very helpful information here.');

View File

@@ -0,0 +1,37 @@
body {
padding-top:120px;
font-size: 2rem;
}
h1 {
font-size: 4rem;
}
h2 {
font-size: 3rem;
}
.navbar-brand {
font-size: 2.25rem;
}
.lead {
font-size: 2.5rem;
}
.employee {
font-size: 1.75rem;
padding-top: 20px;
}
#contact, #employees {
padding-top: 20px;
}
<% if @white_text -%>
#white_text {
color: white;
}
<% end -%>

View File

@@ -0,0 +1,67 @@
<% $current_page = 'Guestbook' -%>
<?php require_once 'config.php'; ?>
<html>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/header.php.erb']) %>
<body>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/navbar.php.erb']) %>
<div id="main_container" class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-text">
<h1 class="name">Guestbook</h1>
<hr class="star-light">
<h3>Leave us a message!</h3>
</div>
</div>
<!-- Guestbook form -->
<div class="col-lg-8 col-lg-offset-2">
<?php
if (isset($_SESSION['guestbook_success'])) {
echo '<div class="alert alert-success">' . $_SESSION['guestbook_success'] . '</div>';
unset($_SESSION['guestbook_success']);
}
?>
<div class="guestbook-form">
<h3>Sign our guestbook</h3>
<form method="POST" action="guestbook_process.php">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="form-group">
<label for="message">Message</label>
<textarea class="form-control" id="message" name="message" rows="4" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
<!-- Display guestbook entries -->
<div class="col-lg-10 col-lg-offset-1">
<h3>Recent Messages</h3>
<hr>
<?php
// INTENTIONALLY VULNERABLE - displays unsanitized user input (XSS)
$query = "SELECT * FROM guestbook ORDER BY timestamp DESC";
$result = $conn->query($query);
if ($result && $result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo '<div class="guestbook-entry">';
echo '<p><strong>' . $row['name'] . '</strong> <small>(' . $row['timestamp'] . ')</small></p>';
echo '<p>' . $row['message'] . '</p>';
echo '<hr>';
echo '</div>';
}
} else {
echo '<p>No messages yet. Be the first to sign our guestbook!</p>';
}
?>
</div>
</div>
</div>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/scripts.php.erb']) %>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<?php require_once 'config.php'; ?>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['name'];
$message = $_POST['message'];
// INTENTIONALLY VULNERABLE - SQL Injection
$query = "INSERT INTO guestbook (name, message) VALUES ('$name', '$message')";
if ($conn->query($query)) {
$_SESSION['guestbook_success'] = 'Thank you for signing our guestbook!';
}
header('Location: guestbook.php');
exit();
}
?>

View File

@@ -0,0 +1,15 @@
<% $current_page = 'Homepage' %>
<?php require_once 'config.php'; ?>
<html>
<% @strings_to_leak.each { |string_to_leak| -%>
<!-- <%= string_to_leak %> -->
<%} -%>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/header.php.erb']) %>
<body>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/navbar.php.erb']) %>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/main_container.php.erb']) %>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/scripts.php.erb']) %>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<% $current_page = 'Intranet Home' %>
<?php require_once 'config.php'; ?>
<html>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/header.php.erb']) %>
<body>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/navbar.php.erb']) %>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/main_container.php.erb']) %>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/scripts.php.erb']) %>
</body>
</html>

View File

@@ -0,0 +1,45 @@
<% $current_page = 'Login' -%>
<?php require_once 'config.php'; ?>
<html>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/header.php.erb']) %>
<body>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/navbar.php.erb']) %>
<div id="main_container" class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-text">
<h1 class="name"><%= @business_name %></h1>
<hr class="star-light">
<h3>Login</h3>
</div>
</div>
<div class="col-lg-6 col-lg-offset-3">
<div class="login-form">
<?php
if (isset($_SESSION['error'])) {
echo '<div class="alert alert-danger">' . $_SESSION['error'] . '</div>';
unset($_SESSION['error']);
}
if (isset($_SESSION['success'])) {
echo '<div class="alert alert-success">' . $_SESSION['success'] . '</div>';
unset($_SESSION['success']);
}
?>
<form method="POST" action="login_process.php">
<div class="form-group">
<label for="username">Username</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-primary">Login</button>
</form>
</div>
</div>
</div>
</div>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/scripts.php.erb']) %>
</body>
</html>

View File

@@ -0,0 +1,29 @@
<?php require_once 'config.php'; ?>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = $_POST['username'];
$password = $_POST['password'];
// INTENTIONALLY VULNERABLE - SQL Injection
$query = "SELECT * FROM Users WHERE username = '$username' AND password = '$password'";
$result = $conn->query($query);
if ($result && $result->num_rows > 0) {
$user = $result->fetch_assoc();
// Set session variables
$_SESSION['logged_in'] = true;
$_SESSION['username'] = $user['username'];
$_SESSION['user_id'] = $user['ID'];
$_SESSION['admin'] = $user['admin'];
$_SESSION['success'] = 'Login successful!';
header('Location: index.php');
exit();
} else {
$_SESSION['error'] = 'Invalid username or password';
header('Location: login.php');
exit();
}
}
?>

View File

@@ -0,0 +1,6 @@
<?php
session_start();
session_destroy();
header('Location: index.php');
exit();
?>

View File

@@ -0,0 +1,7 @@
<?php require_once 'config.php'; ?>
<html>
<body>
<%= @additional_page_contents %>
</body>
</html>

View File

@@ -0,0 +1,128 @@
<% $current_page = 'Profile' -%>
<?php require_once 'config.php'; ?>
<?php
// Check if user is logged in
if (!isset($_SESSION['logged_in']) || !$_SESSION['logged_in']) {
header('Location: login.php');
exit();
}
// INTENTIONALLY VULNERABLE - IDOR: Get user ID from URL parameter
$profile_id = isset($_GET['id']) ? $_GET['id'] : $_SESSION['user_id'];
// INTENTIONALLY VULNERABLE - SQL Injection in the ID parameter
$query = "SELECT * FROM Users WHERE ID = $profile_id";
$result = $conn->query($query);
if (!$result || $result->num_rows == 0) {
$_SESSION['error'] = 'User not found!';
header('Location: profile.php?id=' . $_SESSION['user_id']);
exit();
}
$user = $result->fetch_assoc();
// INTENTIONALLY VULNERABLE - Weak access control: only block viewing admin profiles if you're not admin
// Non-admin users can view any other non-admin user's profile
if ($user['admin'] && !$_SESSION['admin']) {
$_SESSION['error'] = 'Access denied! You cannot view administrator profiles.';
header('Location: profile.php?id=' . $_SESSION['user_id']);
exit();
}
// Check if viewing own profile
$is_own_profile = ($profile_id == $_SESSION['user_id']);
?>
<html>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/header.php.erb']) %>
<body>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/navbar.php.erb']) %>
<div id="main_container" class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-text">
<h1 class="name"><?php echo $is_own_profile ? 'Your Profile' : htmlspecialchars($user['name']) . "'s Profile"; ?></h1>
<hr class="star-light">
</div>
</div>
<!-- Display messages -->
<div class="col-lg-8 col-lg-offset-2">
<?php
if (isset($_SESSION['password_success'])) {
echo '<div class="alert alert-success">' . $_SESSION['password_success'] . '</div>';
unset($_SESSION['password_success']);
}
if (isset($_SESSION['password_error'])) {
echo '<div class="alert alert-danger">' . $_SESSION['password_error'] . '</div>';
unset($_SESSION['password_error']);
}
if (isset($_SESSION['error'])) {
echo '<div class="alert alert-danger">' . $_SESSION['error'] . '</div>';
unset($_SESSION['error']);
}
?>
<?php if (!$is_own_profile): ?>
<div class="alert alert-info">
You are viewing another user's profile.
<a href="profile.php?id=<?php echo $_SESSION['user_id']; ?>">Return to your profile</a>
</div>
<?php endif; ?>
</div>
<!-- User Information -->
<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3>Account Information</h3>
</div>
<div class="panel-body">
<p><strong>User ID:</strong> <?php echo htmlspecialchars($user['ID']); ?></p>
<p><strong>Name:</strong> <?php echo htmlspecialchars($user['name']); ?></p>
<p><strong>Username:</strong> <?php echo htmlspecialchars($user['username']); ?></p>
<p><strong>Email:</strong> <?php echo htmlspecialchars($user['email']); ?></p>
<p><strong>Address:</strong> <?php echo htmlspecialchars($user['address']); ?></p>
<p><strong>Mobile:</strong> <?php echo htmlspecialchars($user['mobile']); ?></p>
<?php if ($user['admin']): ?>
<p><strong>Role:</strong> <span class="label label-danger">Administrator</span></p>
<?php else: ?>
<p><strong>Role:</strong> <span class="label label-default">User</span></p>
<?php endif; ?>
</div>
</div>
</div>
<!-- Change Password Form -->
<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3>Change Password</h3>
</div>
<div class="panel-body">
<!-- INTENTIONALLY VULNERABLE - Can change any user's password if you can view their profile -->
<form method="POST" action="change_password.php">
<input type="hidden" name="username" value="<?php echo $user['username']; ?>">
<div class="form-group">
<label for="new_password">New Password</label>
<input type="password" class="form-control" id="new_password" name="new_password" required>
</div>
<div class="form-group">
<label for="confirm_password">Confirm New Password</label>
<input type="password" class="form-control" id="confirm_password" name="confirm_password" required>
</div>
<button type="submit" class="btn btn-primary">
<?php echo $is_own_profile ? 'Change My Password' : 'Change ' . htmlspecialchars($user['name']) . "'s Password"; ?>
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/scripts.php.erb']) %>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<% $current_page = 'Security Audit Remit' %>
<?php require_once 'config.php'; ?>
<html>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/header.php.erb']) %>
<body>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/navbar.php.erb']) %>
<div id="main_container" class="container">
<div class="row">
<div class="main_page_content">
<%= @security_audit_remit %>
</div>
</div>
</div>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/scripts.php.erb']) %>
</body>
</html>

View File

@@ -0,0 +1,281 @@
<div id="main_container" class="container">
<div class="row">
<div class="main_page_content">
<h1><strong>Acceptable Use Policy</strong></h1>
<h1 id="overview">Overview</h1>
<p>Internet/Intranet/Extranet-related systems, including but not limited to computer equipment, software,
operating
systems, storage media, network accounts providing electronic mail, WWW browsing, and FTP, are the property of
<%= @business_name %>. These systems are to be used for business purposes in serving the interests of the
company, and of our
clients and customers in the course of normal operations. Please review Human Resources policies for further
details.</p>
<p>Effective security is a team effort involving the participation and support of every <%= @business_name %>
employee and
affiliate who deals with information and/or information systems. It is the responsibility of every computer user
to
know these guidelines, and to conduct their activities accordingly.</p>
<h1 id="purpose">Purpose</h1>
<p>The purpose of this policy is to outline the acceptable use of computer equipment at <%= @business_name %>.
These rules are in
place to protect the employee and <%= @business_name %>. Inappropriate use exposes <%= @business_name %> to
risks including virus attacks,
compromise of network systems and services, and legal issues.</p>
<h1 id="scope">Scope</h1>
<p>This policy applies to the use of information, electronic and computing devices, and network resources to
conduct
<%= @business_name %> business or interact with internal networks and business systems, whether owned or leased
by <%= @business_name %>,
the employee, or a third party. All employees, contractors, consultants, temporary, and other workers
at <%= @business_name %>
and its subsidiaries are responsible for exercising good judgment regarding appropriate use of information,
electronic devices, and network resources in accordance with <%= @business_name %> policies and standards, and
local laws and
regulation. Exceptions to this policy are documented in section 5.2</p>
<p>This policy applies to employees, contractors, consultants, temporaries, and other workers
at <%= @business_name %>, including
all personnel affiliated with third parties. This policy applies to all equipment that is owned or leased by
Bednar
Inc.</p>
<ol style="list-style-type: decimal">
<li><p>Policy ======</p>
<ol style="list-style-type: decimal">
<li><p>General Use and Ownership --------------------------</p>
<ol style="list-style-type: decimal">
<li><p><%= @business_name %> proprietary information stored on electronic and computing devices whether
owned
or leased by <%= @business_name %>, the employee or a third party, remains the sole property
of <%= @business_name %>.
You must ensure through legal or technical means that proprietary information is protected in
accordance with the <em>Data Protection Standard.</em>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</p></li>
<li><p>You have a responsibility to promptly report the theft, loss or unauthorized disclosure of
<%= @business_name %> proprietary information.
----------------------------------------------------------------------------------------------------------------------------------------</p>
</li>
<li>
<p>You may access, use or share <%= @business_name %> proprietary information only to the extent it is
authorized and necessary to fulfill your assigned job duties.
----------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
</li>
<li><p>Employees are responsible for exercising good judgment regarding the reasonableness of
personal use. Individual departments are responsible for creating guidelines concerning personal
use of Internet/Intranet/Extranet systems. In the absence of such policies, employees should be
guided by departmental policies on personal use, and if there is any uncertainty, employees
should consult their supervisor or manager.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
</li>
<li>
<p>For security and network maintenance purposes, authorized individuals within <%= @business_name %>
may
monitor equipment, systems and network traffic at any time, per Infosec&rsquo;s <em>Audit Policy</em>.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</p></li>
<li><p><%= @business_name %> reserves the right to audit networks and systems on a periodic basis to
ensure
compliance with this policy.
---------------------------------------------------------------------------------------------------------------------------------</p>
</li>
</ol>
</li>
<li><p><strong>Security and Proprietary Information</strong></p>
<ol style="list-style-type: decimal">
<li><p>All mobile and computing devices that connect to the internal network must comply with the
<em>Minimum Access Policy</em>.</p></li>
<li><p>System level and user level passwords must comply with the <em>Password Policy</em>.
Providing access to another individual, either deliberately or through failure to secure its
access, is prohibited.</p></li>
<li><p>All computing devices must be secured with a password-protected screensaver with the
automatic activation feature set to 10 minutes or less. You must lock the screen or log off when
the device is unattended.</p></li>
<li><p>Postings by employees from a <%= @business_name %> email address to newsgroups should contain a
disclaimer stating that the opinions expressed are strictly their own and not necessarily those
of <%= @business_name %>, unless posting is in the course of business duties.</p></li>
<li><p>Employees must use extreme caution when opening e-mail attachments received from unknown
senders, which may contain malware.</p></li>
</ol>
</li>
<li><p><strong>Unacceptable Use</strong></p></li>
</ol>
</li>
</ol>
<p>The following activities are, in general, prohibited. Employees may be exempted from these restrictions during
the
course of their legitimate job responsibilities (e.g., systems administration staff may have a need to disable
the
network access of a host if that host is disrupting production services).</p>
<p>Under no circumstances is an employee of <%= @business_name %> authorized to engage in any activity that is
illegal under local,
state, federal or international law while utilizing <%= @business_name %>-owned resources.</p>
<p>The lists below are by no means exhaustive, but attempt to provide a framework for activities which fall into
the
category of unacceptable use.</p>
<ol style="list-style-type: decimal">
<li>System and Network Activities</li>
</ol>
<p>The following activities are strictly prohibited, with no exceptions:</p>
<ol style="list-style-type: decimal">
<li><p>Violations of the rights of any person or company protected by copyright, trade secret, patent or other
intellectual property, or similar laws or regulations, including, but not limited to, the installation or
distribution of &quot;pirated&quot; or other software products that are not appropriately licensed for use by
<%= @business_name %>.</p></li>
<li><p>Unauthorized copying of copyrighted material including, but not limited to, digitization and distribution
of
photographs from magazines, books or other copyrighted sources, copyrighted music, and the installation of any
copyrighted software for which <%= @business_name %> or the end user does not have an active license is
strictly
prohibited.</p></li>
<li><p>Accessing data, a server or an account for any purpose other than conducting <%= @business_name %>
business, even if you
have authorized access, is prohibited.</p></li>
<li>
<p>Exporting software, technical information, encryption software or technology, in violation of international
or regional export control laws, is illegal. The appropriate management should be consulted prior to export
of
any material that is in question.</p></li>
<li>
<p>Introduction of malicious programs into the network or server (e.g., viruses, worms, Trojan horses, e-mail
bombs, etc.).</p></li>
<li><p>Revealing your account password to others or allowing use of your account by others. This includes family
and
other household members when work is being done at home.</p></li>
<li>
<p>Using a <%= @business_name %> computing asset to actively engage in procuring or transmitting material that
is in
violation of sexual harassment or hostile workplace laws in the user&rsquo;s local jurisdiction.</p></li>
<li><p>Making fraudulent offers of products, items, or services originating from any <%= @business_name %>
account.</p></li>
<li><p>Making statements about warranty, expressly or implied, unless it is a part of normal job duties.</p>
</li>
<li>
<p>Effecting security breaches or disruptions of network communication. Security breaches include, but are not
limited to, accessing data of which the employee is not an intended recipient or logging into a server or
account that the employee is not expressly authorized to access, unless these duties are within the scope of
regular duties. For purposes of this section, &quot;disruption&quot; includes, but is not limited to,
network
sniffing, pinged floods, packet spoofing, denial of service, and forged routing information for malicious
purposes.</p></li>
<li><p>Port scanning or security scanning is expressly prohibited unless prior notification to Infosec is
made.</p>
</li>
<li><p>Executing any form of network monitoring which will intercept data not intended for the employee&rsquo;s host,
unless this activity is a part of the employee&rsquo;s normal job/duty.</p></li>
<li><p>Circumventing user authentication or security of any host, network or account.</p></li>
<li><p>Introducing honeypots, honeynets, or similar technology on the <%= @business_name %> network.</p></li>
<li><p>Interfering with or denying service to any user other than the employee&rsquo;s host (for example, denial of
service attack).</p></li>
<li><p>Using any program/script/command, or sending messages of any kind, with the intent to interfere with, or
disable, a user&rsquo;s terminal session, via any means, locally or via the Internet/Intranet/Extranet.</p></li>
<li><p>Providing information about, or lists of, <%= @business_name %> employees to parties
outside <%= @business_name %>.</p>
<ol style="list-style-type: decimal">
<li>Email and Communication Activities</li>
</ol>
</li>
</ol>
<p>When using company resources to access and use the Internet, users must realize they represent the company.
Whenever
employees state an affiliation to the company, they must also clearly indicate that &quot;the opinions expressed
are
my own and not necessarily those of the company&quot;. Questions may be addressed to the IT Department</p>
<ol style="list-style-type: decimal">
<li><p>Sending unsolicited email messages, including the sending of &quot;junk mail&quot; or other advertising
material to individuals who did not specifically request such material (email spam).</p></li>
<li><p>Any form of harassment via email, telephone or paging, whether through language, frequency, or size of
messages.</p></li>
<li><p>Unauthorized use, or forging, of email header information.</p></li>
<li>
<p>Solicitation of email for any other email address, other than that of the poster&rsquo;s account, with the intent
to harass or to collect replies.</p></li>
<li>
<p>Creating or forwarding &quot;chain letters&quot;, &quot;Ponzi&quot; or other &quot;pyramid&quot; schemes of
any type.</p></li>
<li><p>Use of unsolicited email originating from within <%= @business_name %>&rsquo;s networks of other
Internet/Intranet/Extranet
service providers on behalf of, or to advertise, any service hosted by <%= @business_name %> or connected
via <%= @business_name %>&rsquo;s
network.</p></li>
<li>
<p>Posting the same or similar non-business-related messages to large numbers of Usenet newsgroups (newsgroup
spam).</p>
<ol style="list-style-type: decimal">
<li>Blogging and Social Media</li>
</ol>
</li>
</ol>
<!-- -->
<ol style="list-style-type: decimal">
<li>
<p>Blogging by employees, whether using <%= @business_name %>s property &gt; and systems or personal computer
systems, is
also subject to the &gt; terms and restrictions set forth in this Policy. Limited and &gt; occasional use of
<%= @business_name %>s systems to engage in &gt; blogging is acceptable, provided that it is done in a
professional &gt;
and responsible manner, does not otherwise violate &gt; <%= @business_name %>s policy, is not detrimental
to <%= @business_name %>s
&gt; best interests, and does not interfere with an employee&rsquo;s regular &gt; work duties. Blogging from
Bednar
Incs systems is also &gt; subject to monitoring.</p></li>
<li><p><%= @business_name %>s Confidential Information policy also applies &gt; to blogging. As such, Employees
are prohibited
from revealing any &gt; <%= @business_name %> confidential or proprietary information, trade &gt; secrets or
any other
material covered by <%= @business_name %>s &gt; Confidential Information policy when engaged in blogging.</p>
</li>
<li><p>Employees shall not engage in any blogging that may harm or tarnish &gt; the image, reputation and/or
goodwill of <%= @business_name %> &gt; and/or any of its employees. Employees are also prohibited from &gt;
making any
discriminatory, disparaging, defamatory or harassing &gt; comments when blogging or otherwise engaging in any
conduct &gt; prohibited by <%= @business_name %>s <em>Non-Discrimination and &gt; Anti-Harassment</em>
policy.</p></li>
<li><p>Employees may also not attribute personal statements, opinions or &gt; beliefs to <%= @business_name %>
when engaged in
blogging. If an &gt; employee is expressing his or her beliefs and/or opinions in &gt; blogs, the employee may
not, expressly or implicitly, represent &gt; themselves as an employee or representative
of &gt; <%= @business_name %>.
Employees assume any and all risk associated &gt; with blogging.</p></li>
<li><p>Apart from following all laws pertaining to the handling and &gt; disclosure of copyrighted or export
controlled materials, &gt; <%= @business_name %>s trademarks, logos and any other <%= @business_name %> &gt;
intellectual property
may also not be used in connection &gt; with any blogging activity</p></li>
</ol>
<!-- -->
<ol style="list-style-type: decimal">
<li><p>Policy Compliance =================</p>
<ol style="list-style-type: decimal">
<li><p>Compliance Measurement</p>
<p>The Infosec team will verify compliance to this policy through various methods, including but not
limited to, business tool reports, internal and external audits, and feedback to the policy
owner.</p></li>
<li><p>Exceptions ==========</p>
<p>Any exception to the policy must be approved by the Infosec team in advance.</p></li>
<li><p>Non-Compliance ==============</p>
<p>An employee found to have violated this policy may be subject to disciplinary action, up to and
including termination of employment.</p></li>
</ol>
</li>
<li><p>Related Standards, Policies and Processes =========================================</p></li>
</ol>
<ul>
<li><p>Data Classification Policy</p></li>
<li><p>Data Protection Standard</p></li>
<li><p>Social Media Policy</p></li>
<li><p>Minimum Access Policy</p></li>
<li><p>Password Policy</p></li>
</ul>
<h1 id="definitions-and-terms">Definitions and Terms</h1>
<p>The following definition and terms can be found in the SANS Glossary located at:</p>
<p>https://www.sans.org/security-resources/glossary-of-terms/</p>
<ul>
<li><p>Blogging</p></li>
<li><p>Honeypot</p></li>
<li><p>Honeynet</p></li>
<li><p>Proprietary Information</p></li>
<li><p>Spam</p></li>
</ul>
</div>
</div>
</div>

View File

@@ -0,0 +1,14 @@
<% $page_title = @business_name != '' ? "#{@business_name} - #{$current_page}" : $current_page -%>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><%= $page_title %></title>
<!-- Default stylesheet -->
<link rel="stylesheet" href="css/bootstrap.min.css" media="screen"/>
<link rel="stylesheet" href="css/<%= @theme %>" />
<link rel="stylesheet" href="css/default.css"/>
</head>

View File

@@ -0,0 +1,53 @@
<div class="container">
<% if @business_name != ''-%>
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-8 col-md-7 col-sm-6">
<h1><%= @business_name %></h1>
<% if @business_motto != ''-%>
<p class="lead"><%= @business_motto %></p>
<% end -%>
</div>
</div>
</div>
<% end -%>
<div class="bs-docs-section clearfix">
<div class="row">
<div class="main_page_content">
<% # Intranet style -%>
<% if @security_audit or @acceptable_use_policy -%>
<p class="lead">Welcome to the internal intranet server for <%= @business_name %>.</p>
<% if @security_audit -%>
<p>Find your Security Audit Remit <a href="security_audit_remit.php">here</a>.</p>
<% end -%>
<% if @acceptable_use_policy -%>
<p>Find the Acceptable Use Policy <a href="acceptable_use_policy.php">here</a>.</p>
<% end -%>
<% # Default style -%>
<% else -%>
<% @main_page_paragraph_content.each do |pg| -%>
<%= pg %>
<% end -%>
<br/>
<% end -%>
<% if @visible_tabs and @visible_tabs[0] != '' -%>
<%= scope.function_template(['vuln_parameterised_website/subtemplates/tab_panel.php.erb']) %>
<% end -%>
<br/>
<% if @images_to_leak -%>
<% @images_to_leak.each_with_index {|img, counter| -%>
<% unless img == '' -%>
<img src="image<%= counter + 1 %>.png" height="128" width="128">
<% end -%>
<% } -%>
<% end -%>
</div>
</div>
</div>
</div>
<% if @white_text -%>
<div id="white_text"><%= @white_text.join %></div>
<% end -%>

View File

@@ -0,0 +1,24 @@
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<div class="container">
<div class="navbar-brand"><%= @business_name %></div>
<div class="collapse navbar-collapse" id="navbarResponsive" >
<ul class="nav navbar-nav">
<li class="nav-item"><a class="nav-link" href="index.php">Home</a></li>
<% if @security_audit -%>
<li class="nav-item"><a class="nav-link" href="security_audit_remit.php">Security Audit Remit</a></li>
<% end -%>
<% if @acceptable_use_policy -%>
<li class="nav-item"><a class="nav-link" href="acceptable_use_policy.php">Acceptable Use Policy</a></li>
<% end -%>
<li class="nav-item"><a class="nav-link" href="contact.php">Contact Us</a></li>
<li class="nav-item"><a class="nav-link" href="guestbook.php">Guestbook</a></li>
<?php if (isset($_SESSION['logged_in']) && $_SESSION['logged_in']): ?>
<li class="nav-item"><a class="nav-link" href="profile.php?id=<?php echo $_SESSION['user_id']; ?>">Profile</a></li>
<li class="nav-item"><a class="nav-link" href="logout.php">Logout (<?php echo htmlspecialchars($_SESSION['username']); ?>)</a></li>
<?php else: ?>
<li class="nav-item"><a class="nav-link" href="login.php">Login</a></li>
<?php endif; ?>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>

View File

@@ -0,0 +1,5 @@
<!-- Latest compiled JavaScript -->
<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/default.js"></script>

View File

@@ -0,0 +1,14 @@
<div id="tabs">
<ul class="nav nav-tabs">
<li class="nav-item active"><a class="nav-link active" data-toggle="tab" href="#start_tab">Start here!</a></li>
<% @visible_tabs.each_with_index { |_, counter| -%>
<% if counter != 0 && counter != @visible_tabs.length -%>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="tab_<%= counter %>.php"><%= counter %></a></li>
<% end -%>
<% } %>
</ul>
<div id="start_tab">
<%= @visible_tabs[0] %>
</div>
</div>

View File

@@ -0,0 +1,3 @@
include vuln_parameterised_website::apache
include vuln_parameterised_website::install
include vuln_parameterised_website::db_setup

View File

@@ -0,0 +1,73 @@
<?xml version="1.0"?>
<scenario xmlns="http://www.github/cliffe/SecGen/scenario"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.github/cliffe/SecGen/scenario">
<name>Fictional organisation security audit</name>
<author>Thomas Shaw</author>
<author>Z. Cliffe Schreuders</author>
<description>A set of VMs for a randomly generated fictional organisation, with a desktop system, webserver, and intranet server.
Note that the intranet server has a security remit, with instructions on performing a security audit of these systems. The desktop system can access the intranet to access the remit, but the attacker VM (for example, Kali) can be connected to the NIC only shared by the Web server to simulate the need to pivot attacks through the Web server, as they can't connect to the intranet system directly. The "marking guide" is in the form of the output scenario.xml in the project directory, which provides the details of the systems generated.
</description>
<type>blind-audit</type>
<difficulty>intermediate</difficulty>
<!-- TODO: update the oVirt plugin to work with multiple NICs and re-introduce pivoting -->
<!-- Web Server on NIC1 and NIC2 -->
<system>
<system_name>web_server</system_name>
<base distro="Debian 12" type="desktop" name="KDE"/>
<input into_datastore="IP_addresses">
<value>172.10.0.2</value>
</input>
<input into_datastore="spoiler_admin_pass">
<value>tiaspbiqe2r</value>
</input>
<input into_datastore="organisation">
<encoder type="line_selector">
<input into="file_path">
<value>lib/resources/structured_content/organisations/json_organisations</value>
</input>
</encoder>
</input>
<vulnerability module_path="vulnerabilities/unix/http/vuln_parameterised_website">
<input into="host_acceptable_use_policy">
<value>true</value>
</input>
<input into="security_audit">
<encoder type="markdown_to_html_encoder">
<input into="strings_to_encode">
<generator module_path=".*/security_audit_remit">
<input into="business_name">
<datastore access_json="['business_name']">organisation</datastore>
</input>
</generator>
</input>
</encoder>
</input>
<input into="organisation">
<datastore>organisation</datastore>
</input>
</vulnerability>
<build type="cleanup">
<input into="root_password">
<datastore>spoiler_admin_pass</datastore>
</input>
</build>
<network type="private_network">
<input into="IP_address">
<datastore access="next">IP_addresses</datastore>
</input>
</network>
</system>
</scenario>

View File

@@ -34,7 +34,7 @@
<generator type="password_generator"/>
</input>
<service module_path="services/unix/http/parameterised_website">
<vulnerability module_path="vulnerabilities/unix/http/vuln_parameterised_website">
<input into="organisation" into_datastore="organisation">
<encoder type="line_selector">
<input into="file_path">
@@ -45,7 +45,7 @@
<input into="theme" into_datastore="theme">
<generator type="website_theme"/>
</input>
</service>
</vulnerability>
<vulnerability privilege="user_rwx" access="remote" type="(?!.*webapp|ctf).*">
<input into="organisation">
@@ -86,7 +86,7 @@
<base distro="Debian 12" type="desktop" name="KDE"/>
<!-- Web server hosting acceptable use policy and security audit remit -->
<service module_path="services/unix/http/parameterised_website">
<vulnerability module_path="vulnerabilities/unix/http/vuln_parameterised_website">
<input into="host_acceptable_use_policy">
<value>true</value>
</input>
@@ -107,7 +107,7 @@
<input into="theme">
<datastore>theme</datastore>
</input>
</service>
</vulnerability>
<!-- Create accounts for the 3 employees -->
<utility module_path=".*/parameterised_accounts">