Refactoring (#1201)

* Some initial refactoring

* Make it one application

* Got it working

* Fix problem on Windows

* Move WebWolf

* Move first lesson

* Moved all lessons

* Fix pom.xml

* Fix tests

* Add option to initialize a lesson

This way we can create content for each user inside a lesson. The initialize method will be called when a new user is created or when a lesson reset happens

* Clean up pom.xml files

* Remove fetching labels based on language.

We only support English at the moment, all the lesson explanations are written in English which makes it very difficult to translate. If we only had labels it would make sense to support multiple languages

* Fix SonarLint issues

* And move it all to the main project

* Fix for documentation paths

* Fix pom warnings

* Remove PMD as it does not work

* Update release notes about refactoring

Update release notes about refactoring

Update release notes about refactoring

* Fix lesson template

* Update release notes

* Keep it in the same repo in Dockerhub

* Update documentation to show how the connection is obtained.

Resolves: #1180

* Rename all integration tests

* Remove command from Dockerfile

* Simplify GitHub actions

Currently, we use a separate actions for pull-requests and branch build.
This is now consolidated in one action.
The PR action triggers always, it now only trigger when the PR is
opened and not in draft.
Running all platforms on a branch build is a bit too much, it is better
 to only run all platforms when someone opens a PR.

* Remove duplicate entry from release notes

* Add explicit registry for base image

* Lesson scanner not working when fat jar

When running the fat jar we have to take into account we
are reading from the jar file and not the filesystem. In
this case you cannot use `getFile` for example.

* added info in README and fixed release docker

* changed base image and added ignore file

Co-authored-by: Zubcevic.com <rene@zubcevic.com>
This commit is contained in:
Nanne Baars
2022-04-09 14:56:12 +02:00
committed by GitHub
parent f3d8206a07
commit 711649924b
1130 changed files with 3540 additions and 7643 deletions

View File

@ -0,0 +1,88 @@
= Spoofing an Authentication Cookie
== Solution
Some standard Linux tools have been used on this solution; other kind of tools -like online tools- can be used and the same results should be obtained.
=== Analysis and reversing
Inspect the webgoat user spoof_auth cookie value:
[source, text]
----
NjM3OTRhNGY0ODRiNTQ0OTU3NDU3NDYxNmY2NzYyNjU3Nw==
----
It look like a base64 encoded text.
Decoding the base64 text:
[source, sh]
----
echo NjM3OTRhNGY0ODRiNTQ0OTU3NDU3NDYxNmY2NzYyNjU3Nw== | base64 -d
63794a4f484b5449574574616f67626577
----
Now, it look like a hexadecimal encoded text.
Hexadecimal text decoding:
[source, sh]
----
echo 63794a4f484b5449574574616f67626577 | xxd -p -r
cyJOHKTIWEtaogbew
----
Now, reverse the text:
[source, text]
----
webgoatEWITKHOJyc
----
We can see the user name with some random text appended. If we request some more different cookies for the same user, we will observe that the cookie generation appends random text of ten characters together with the user name, after it reverses the whole string and encodes it as hexadecimal and base64 respectively.
=== Attacking the system
Let's see how to forge our authentication cookie for tom.
Our initial string will be the user name and a random text of ten characters.
[source,text]
----
tomAAAAAAAAAA
----
Reverse it:
[source, text]
----
AAAAAAAAAAmot
----
Now, encode the text to hexadecimal:
[source,text]
----
# warn: do not encode any whitespace or new line character
echo -n AAAAAAAAAAmot | xxd -ps
414141414141414141416d6f74
----
Encode to base64:
[source,text]
----
# warn: do not encode any whitespace or new line character
echo -n 414141414141414141416d6f74 | base64
NDE0MTQxNDE0MTQxNDE0MTQxNDE2ZDZmNzQ=
----
The spoof_auth cookie value is:
[source,text]
----
NDE0MTQxNDE0MTQxNDE0MTQxNDE2ZDZmNzQ=
----
Finally, send the cookie to the system using any method that you prefer; OWASP ZAP, curl, the browser developer tools, etc.

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<div class="lesson-page-wrapper">
<!-- reuse this block for each 'page' of content -->
<!-- include content here ... will be first page/tab multiple -->
<div class="adoc-content" th:replace="doc:SpoofCookie_solution.adoc"></div>
</div>
</html>