diff --git a/app/www_release/css/style.css b/app/www_release/css/style.css new file mode 100644 index 0000000..a232d7b --- /dev/null +++ b/app/www_release/css/style.css @@ -0,0 +1,4 @@ +body { + background-color: black; + color: green; +} \ No newline at end of file diff --git a/app/www_release/index.html b/app/www_release/index.html new file mode 100644 index 0000000..7d836fd --- /dev/null +++ b/app/www_release/index.html @@ -0,0 +1,16 @@ + + + + + + + My App + + + + + + +

+ + \ No newline at end of file diff --git a/app/www_release/js/script.js b/app/www_release/js/script.js new file mode 100644 index 0000000..f00eb3e --- /dev/null +++ b/app/www_release/js/script.js @@ -0,0 +1,4 @@ +var d = new Date(); +var date = d.getMonth() + "/" + d.getDay() + "/" +d.getFullYear(); +var todayString = "Today is " + date + "\n"; +window.document.getElementById("myText").innerText = todayString.repeat(10); \ No newline at end of file diff --git a/app/wwwroot/css/style.css b/app/wwwroot/css/style.css new file mode 100644 index 0000000..a232d7b --- /dev/null +++ b/app/wwwroot/css/style.css @@ -0,0 +1,4 @@ +body { + background-color: black; + color: green; +} \ No newline at end of file diff --git a/app/wwwroot/index.html b/app/wwwroot/index.html new file mode 100644 index 0000000..7d836fd --- /dev/null +++ b/app/wwwroot/index.html @@ -0,0 +1,16 @@ + + + + + + + My App + + + + + + +

+ + \ No newline at end of file diff --git a/app/wwwroot/js/script.js b/app/wwwroot/js/script.js new file mode 100644 index 0000000..f00eb3e --- /dev/null +++ b/app/wwwroot/js/script.js @@ -0,0 +1,4 @@ +var d = new Date(); +var date = d.getMonth() + "/" + d.getDay() + "/" +d.getFullYear(); +var todayString = "Today is " + date + "\n"; +window.document.getElementById("myText").innerText = todayString.repeat(10); \ No newline at end of file diff --git a/files/script/dirChecker.ps1 b/files/script/dirChecker.ps1 new file mode 100644 index 0000000..86509da --- /dev/null +++ b/files/script/dirChecker.ps1 @@ -0,0 +1,63 @@ +<# +.SYNOPSIS +Find new or changed files in a directory compared to a known-good image. + +.DESCRIPTION +The script looks for file changes/additions between a production directory (target) with a known-good directory. + +.PARAMETER knownGood +Path of the known-good directory. + +.PARAMETER productionImage +Path of the production directory (target). + +.INPUTS +System.String + +.OUTPUTS +System.String + +.EXAMPLE +.\dirChecker.ps1 -knownGood -productionImage +.\dirChecker.ps1 -knownGood .\knownGoodDir\ -productionImage .\targetDir\ +.\dirChecker.ps1 -knownGood "D:\release3.0" -productionImage "C:\inetpub\wwwroot" + +-- Input -- +.\dirChecker.ps1 -knownGood "D:\Users\\Documents\knownGoodDir" -productionImage "C:\Users\\Documents\targetDir" + +-- Output -- +File analysis started. +Any file listed below is a new or changed file. + +C:\Users\\Documents\targetDir\index.html +C:\Users\\Documents\targetDir\research.docx +C:\Users\\Documents\targetDir\inventory.csv +C:\Users\\Documents\targetDir\contactus.js + +File analysis completed. + +.LINK +https://github.com/nsacyber/Mitigating-Web-Shells +#> + +<# +# +# Execution begins. +# +#> +param ( + [Parameter(Mandatory=$TRUE)][ValidateScript({Test-Path $_ -PathType 'Container'})][String] $knownGood, + [Parameter(Mandatory=$TRUE)][ValidateScript({Test-Path $_ -PathType 'Container'})][String] $productionImage +) + +# Recursively get all files in both directories, for each file calculate hash. +$good = Get-ChildItem -Force -Recurse -Path $knownGood | ForEach-Object { Get-FileHash -Path $_.FullName } +$prod = Get-ChildItem -Force -Recurse -Path $productionImage | ForEach-Object { Get-FileHash -Path $_.FullName } + +Write-Host "File analysis started." +Write-Host "Any file listed below is a new or changed file.`n" + +# Compare files hashes, select new or changed files, and print the path+filename. +(Compare-Object $good $prod -Property hash -PassThru | Where-Object{$_.SideIndicator -eq '=>'}).Path + +Write-Host "`nFile analysis completed." diff --git a/files/zip/integrity_lab.zip b/files/zip/integrity_lab.zip new file mode 100644 index 0000000..5c1781a Binary files /dev/null and b/files/zip/integrity_lab.zip differ diff --git a/labs/lab_01/lab_01_instructions.md b/labs/lab_01/lab_01_instructions.md new file mode 100644 index 0000000..615d56c --- /dev/null +++ b/labs/lab_01/lab_01_instructions.md @@ -0,0 +1,28 @@ +# Integrity Lab - Lab01 + +## Definition of Integrity + +> *Data integrity is what the "I" in CIA Triad stands for. This is an essential component of the CIA Triad and designed to protect data from deletion or modification from any unauthorized party, and it ensures that when an authorized person makes a change that should not have been made the damage can be reversed.* [^1] + +> *In information security, data integrity means maintaining and assuring the accuracy and completeness of data over its entire lifecycle. This means that data cannot be modified in an unauthorized or undetected manner. This is not the same thing as referential integrity in databases, although it can be viewed as a special case of consistency as understood in the classic ACID model of transaction processing. Information security systems typically provide message integrity alongside confidentiality.* [^2] + +## What is Power Shell + +> *PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.* +> +> *PowerShell commands let you manage computers from the command line. PowerShell providers let you access data stores, such as the registry and certificate store, as easily as you access the file system. PowerShell includes a rich expression parser and a fully developed scripting language.* [^3] + +## Preparation + +Download and unzip the integrity_lab.zip archive into your **Documents** folder. + +If you don’t have the zip file you can directly download the individual required documents here: + +The www_release folder will be used as your golden image; this concept will be explained later. + + +### Footnotes + +[^1]: [What is the CIA Triad?](https://www.forcepoint.com/cyber-edu/cia-triad) +[^2]: [Information Security](https://en.wikipedia.org/wiki/Information_security#Integrity) +[^3]: [What is PowerShell?](https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7)