juice-shop analyzed

This commit is contained in:
Florian Hoss 2022-04-07 15:09:33 +02:00
parent ba6e5a9c17
commit ed6397d1af
19 changed files with 2071 additions and 0 deletions

374
Lab01/documentation/.gitignore vendored Normal file
View file

@ -0,0 +1,374 @@
# ---> Windows
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# ---> Linux
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# ---> macOS
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# ---> TeX
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs
*.slg
*.slo
*.sls
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplot
*.gnuplot
*.table
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.glog
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# newpax
*.newpax
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# svg
svg-inkscape/
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# titletoc
*.ptc
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib
main.pdf

View file

@ -0,0 +1,9 @@
@book{example-book,
title = {{Example Book}},
author = {Lastname, Surname},
isbn = {123456789},
address = {Germany},
publisher = {Goverment},
year = {2019},
edition = {Second}
}

View file

@ -0,0 +1,7 @@
@online{juice-shop,
author = {{Juice Shop}},
title = {Docker Image},
urldate = {2022-03-07},
year = {2022},
url = {https://hub.docker.com/r/bkimminich/juice-shop/}
}

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View file

@ -0,0 +1,149 @@
\section{Juice Shop}
\subsection{Docker}
Um die Seite lokal im docker zu betreiben wurde folgende ``docker-compose.yml'' genutzt:
\begin{lstlisting}
version: "3.9"
services:
juice-shop:
image: bkimminich/juice-shop:latest
container_name: juice-shop
restart: unless-stopped
ports:
- 3000:3000
\end{lstlisting}
Es muss nun lediglich ein ``docker-compose up'' ausgeführt werden.
\cite[vgl. dazu][]{juice-shop}
\subsection{Analyse}
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\textwidth]{juice/juice-01}
\caption{Startseite Juice Shop}
\label{fig:Startseite Juice Shop}
\end{center}
\end{figure}
Auf der Startseite (Abbildung \ref{fig:Startseite Juice Shop}) wird man mit verschiedenen Pop-Ups begrüßt. Es beschreibt, das die Seite nicht sicher sei. Die Programmierung wird von der Open Web Application Security Project Foundation\footnote{\href{https://owasp.org/}{https://owasp.org/}} bereitgestellt. Wenn man das Tutorial startet, wird man auf verschiedene Dinge hingewiesen, wie die Sicherheitslücken gefunden werden können.
\newpage
So wird zum Beispiel erklärt, dass man mit F12 den Javascript-Code der Seite analysieren könnte (Abbildung \ref{fig:Javascript in den Entwicklertools von Firefox}). Der Vorschlag ist gut, da mit einer Sucher der Pfad entdeckt werden kann (Abbildung \ref{fig:Pfad des Score-Boards}).
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.9\textwidth]{juice/juice-02}
\caption{Javascript in den Entwicklertools von Firefox}
\label{fig:Javascript in den Entwicklertools von Firefox}
\end{center}
\begin{center}
\includegraphics[width=0.9\textwidth]{juice/juice-03}
\caption{Pfad des Score-Boards}
\label{fig:Pfad des Score-Boards}
\end{center}
\end{figure}
\newpage
Wenn man nun noch nach Admin sucht, kann man eine Route in das Aministrations-Panel finden. Leider sind wir aber nicht Berechtigt die Seite zu sehen (Abbildung \ref{fig:403 Administration}). Beim Ausprobieren wie ich die Daten des Admins bekommen kann, hat ein Fehler den Server zum Absturz gebracht (Abbildung \ref{fig:Server Absturz}). Aber mir einer SQL Injection über das Suchfeld kann als Antwort des Servers das Array an Benutzern ausgelesen werden (Abbildung \ref{fig:Server Absturz}).
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\textwidth]{juice/juice-04}
\caption{403 Administration}
\label{fig:403 Administration}
\end{center}
\end{figure}
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\textwidth]{juice/juice-06}
\caption{SQLITE error}
\label{fig:SQLITE error}
\end{center}
\end{figure}
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\textwidth]{juice/juice-05}
\caption{Server Absturz}
\label{fig:Server Absturz}
\end{center}
\end{figure}
Nun kann man den SQL Befehl so anpassen, damit durch ``OR TRUE --'' immer true zurück kommt und eine Authentifizierung mit dem ersten Nutzer in der Datenbank möglich ist. Glücklicherweise ist das der admin (Abbildung \ref{fig:Login Admin}).
\begin{verbatim}
"SELECT * FROM Users WHERE email = ''' OR TRUE -- AND password =
'202cb962ac59075b964b07152d234b70' AND deletedAt IS NULL"
\end{verbatim}
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\textwidth]{juice/juice-07}
\caption{Login Admin}
\label{fig:Login Admin}
\end{center}
\end{figure}
Nun können wir das Admin-Panel, welches vorher nicht für uns zur Verfügung stand, nutzen. Unter ``http:\//\//localhost:3000\//\#\//administration'' sehen wir nun das Feedback der Nutzer (Abbildung \ref{fig:Admin-Panel}).
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\textwidth]{juice/juice-08}
\caption{Admin-Panel}
\label{fig:Admin-Panel}
\end{center}
\end{figure}
\newpage
Im Score-Board gibt es ein Tutorial zum Erstellen eines Feedbacks unter einem anderen Account. Dazu gibt man zuerst ein normales Feedback. der Request sieht wie folgt aus (Abbildung \ref{fig:Feedback Request}):
\begin{verbatim}
{
"UserId": 1,
"captchaId": 2,
"captcha": "78",
"comment": "test (***in@juice-sh.op)",
"rating": 2
}
\end{verbatim}
Damit kann man in z.B. Postman ein Post Request unter einem anderen Namen mit dem neu vorgeschlagenen Captcha (Abbildung \ref{fig:Captcha Lösung}) machen (Abbildung \ref{fig:Neues Feedback mit falschem Namen}).
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\textwidth]{juice/juice-09}
\caption{Feedback Request}
\label{fig:Feedback Request}
\end{center}
\end{figure}
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\textwidth]{juice/juice-11}
\caption{Captcha Lösung}
\label{fig:Captcha Lösung}
\end{center}
\end{figure}
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\textwidth]{juice/juice-10}
\caption{Neues Feedback mit falschem Namen}
\label{fig:Neues Feedback mit falschem Namen}
\end{center}
\end{figure}
Damit haben wir insgesamt 6 Schwachstellen herausgefunden (Abbildung \ref{fig:Score Board Ergebnis}).
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\textwidth]{juice/juice-12}
\caption{Score Board Ergebnis}
\label{fig:Score Board Ergebnis}
\end{center}
\end{figure}

View file

@ -0,0 +1,108 @@
\documentclass[
a4paper,
oneside,
parskip=half,
listof=entryprefix,
listof=totoc,
index=totoc,
bibliography=totoc
]{scrartcl}
\usepackage{silence}
\WarningFilter{biblatex}{File 'ngerman-iso.lbx'}
\WarningFilter{biblatex}{'\mainlang'}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{pdfpages,graphicx,subcaption,lastpage}
\graphicspath{ {./images} }
\usepackage{geometry}
\geometry{a4paper, top=2.5cm, left=2.5cm, right=2.5cm, bottom=2.5cm}
\usepackage{float,listings,xcolor,csquotes,microtype,scrlayer-scrpage,etoolbox}
\usepackage[official]{eurosym}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\definecolor{weborange}{rgb}{1,0.65,0}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
emph={int,char,double,float,unsigned,void,bool},
emphstyle={\color{weborange}},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
firstnumber=1,
}
\lstset{style=mystyle}
\setuptoc{toc}{totoc}
\usepackage[
backend=biber,
urldate=long,
style=iso-authoryear,
natbib=true,
useauthor=true,
mincitenames=1,
maxcitenames=3
]{biblatex}
\addbibresource{bib/online.bib}
\addbibresource{bib/book.bib}
\DefineBibliographyStrings{ngerman}{
andothers = {{et\,al\adddot}},
online = {{online}},
urlseen = {{Zugriff am:}},
urlfrom = {{Verfügbar unter:}},
}
\DeclareNameAlias{default}{family-given/given-family}
\renewcommand*{\finalnamedelim}{\addspace{}und\space}
\AtEveryCite{
\renewcommand*{\multinamedelim}{,\space}
\renewcommand*{\nameyeardelim}{\space}
}
\AtBeginBibliography{
\renewcommand*{\multinamedelim}{,\space}
}
\AfterTOCHead[lof]{\appto\autodot{:}}
\ihead{Lab 1}
\chead{ITSec}
\ohead{Florian Hoss}
\ofoot{Seite~\thepage{}/\pageref{LastPage}}
\cfoot{}
\title{Example Title}
\usepackage[breaklinks,colorlinks,linkcolor=black,citecolor=black,filecolor=black,urlcolor=black]{hyperref}
\begin{document}
\include{titlepage/titlepage}
\tableofcontents
\newpage
\listoffigures
\include{juiceshop/juiceshop}
\printbibliography[title=Literaturverzeichnis]
\end{document}

View file

@ -0,0 +1,24 @@
\newcommand{\HRule}[2]{\noindent\rule[#1]{\linewidth}{#2}}
\newcommand{\vlinespace}[1]{\vspace*{#1\baselineskip}}
\newcommand{\titleemph}[1]{\textbf{#1}}
\begin{titlepage}
\sffamily
\hfill
\includegraphics[width=5cm]{hs-esslingen}
\HRule{13pt}{1pt}
\centering
\Large
\vlinespace{10}\\
Lab 1\\
\huge
\textbf{Web Application Security}\\
\Large
\vlinespace{8}
\huge
\textbf{Florian Hoss}\\
\Large
\vfill
\raggedright{}
\HRule{13pt}{1pt} \\
\titleemph{Dozent:} Prof. Dr. rer. nat. Tobias Heer
\end{titlepage}