Skip to content

Commit b2e9f25

Browse files
merge conflict resolved
2 parents eb60468 + 73f3309 commit b2e9f25

File tree

7 files changed

+267
-793
lines changed

7 files changed

+267
-793
lines changed

Solutions/solution.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,12 @@ Results page contains the word `TEXT` in Heading as well as Green color hence XS
259259

260260
Now you can go ahead and enter `<script >alert(“xss”) </script >` once XSS is confirmed.
261261

262-
To see results on screen, make sure your browser has JavaScript enabled.
262+
To see results on screen, make sure your browser has JavaScript enabled.
263+
264+
**Lab 3**
265+
- ##### [ step- 1 ] Checking user input is being reflected or not
266+
- Though alphanumeric characters are being escaped we can still write js code with these 6 character `![]()+`
267+
- check [jsfuck](http://www.jsfuck.com/)
263268

264269

265270
## A8:Insecure Deserialization

app.log

Lines changed: 189 additions & 769 deletions
Large diffs are not rendered by default.

introduction/templates/Lab/XSS/xss.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ <h4>Exploiting the Reflection of the search query </h4>
100100
<div align="right"> <button class="btn btn-info" type="button" onclick="window.location.href='/xssL2'">Access
101101
Lab</button></div>
102102
</div>
103+
104+
<button class="coll btn btn-info">Lab Details</button>
105+
<div class="lab">
106+
<p class="bp">
107+
This lab is a demonstration of a Reflected XSS
108+
</p>
109+
<p class="bp">The goal of this challenge is to trigger an alert, User input is being Reflected on script Tag, but the real challenge lies in the fact that all alphanumeric characters are escaped. Can you find way to pop an alert ?
110+
</p>
111+
112+
113+
<br>
114+
<div align="right"> <button class="btn btn-info" type="button" onclick="window.location.href='/xssL3'">Access
115+
Lab</button></div>
116+
</div>
103117
<br>
104118

105119

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{% extends "introduction/base.html" %}
2+
{% block content %}
3+
{% block title %}
4+
5+
<title>XSS LAB 2</title>
6+
{% endblock %}
7+
<h1>Welcome to XSS Challenge</h1>
8+
<form method="post" action="/xssL3">
9+
{% csrf_token %}
10+
<div class="jumbotron">
11+
<label for="username">Name:</label>
12+
<input type="text" class="form-control" id="username" name="username" required>
13+
</div>
14+
<button class="btn btn-info" type="submit">
15+
Go
16+
</button>
17+
</form>
18+
<br>
19+
<p>{{code}}</p>
20+
<script>
21+
// LAB 3 JS CODE
22+
{{code}}
23+
</script>
24+
<br>
25+
<div align="right">
26+
<button class="btn btn-info" type="button" onclick="window.location.href='/xss'">Back to Lab Details</button>
27+
</div>
28+
{% endblock content %}

introduction/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
path('xss', views.xss,name="xss"),
1010
path('xssL',views.xss_lab,name='xss_lab'),
1111
path('xssL2', views.xss_lab2, name='xss_lab2'),
12+
path('xssL3', views.xss_lab3, name='xss_lab3'),
1213
path('xssL1',views.xss_lab,name='xss_lab'),
1314
path("sql",views.sql,name='sql'),
1415
path("sql_lab",views.sql_lab,name="sql_lab"),

introduction/views.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from argon2 import PasswordHasher
3939
import logging
4040
import requests
41+
import re
4142
#*****************************************Login and Registration****************************************************#
4243

4344
def register(request):
@@ -115,6 +116,21 @@ def xss_lab2(request):
115116
return render(request, 'Lab/XSS/xss_lab_2.html', context)
116117
else:
117118
return redirect('login')
119+
120+
def xss_lab3(request):
121+
if request.user.is_authenticated:
122+
if request.method == 'POST':
123+
username = request.POST.get('username')
124+
print(type(username))
125+
pattern = r'\w'
126+
result = re.sub(pattern, '', username)
127+
context = {'code':result}
128+
return render(request, 'Lab/XSS/xss_lab_3.html',context)
129+
else:
130+
return render(request, 'Lab/XSS/xss_lab_3.html')
131+
132+
else:
133+
return redirect('login')
118134

119135
#***********************************SQL****************************************************************#
120136

requirements.txt

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
1+
argon2==0.1.10
12
argon2-cffi==21.3.0
23
argon2-cffi-bindings==21.2.0
3-
asgiref==3.5.2
4-
certifi==2022.6.15
5-
cffi==1.15.0
6-
charset-normalizer==2.0.12
7-
click==8.1.3
8-
colorama==0.4.5
9-
cryptography==37.0.2
4+
asgiref==3.6.0
5+
certifi==2022.12.7
6+
cffi==1.15.1
7+
charset-normalizer==3.0.1
8+
cryptography==39.0.1
109
defusedxml==0.7.1
1110
dj-database-url==0.5.0
12-
Django==4.0.4
13-
django-allauth==0.51.0
14-
django-crispy-forms==1.14.0
11+
Django==4.1.7
12+
django-allauth==0.52.0
13+
django-crispy-forms==2.0
1514
django-heroku==0.3.1
16-
flake8==3.9.0
17-
Flask==2.1.2
18-
gunicorn==20.1.0
19-
idna==3.3
20-
importlib-metadata==4.11.4
21-
itsdangerous==2.1.2
22-
Jinja2==3.1.2
23-
MarkupSafe==2.1.1
15+
idna==3.4
2416
mccabe==0.6.1
25-
oauthlib==3.2.0
26-
php-wsgi==0.0.12
27-
Pillow==8.0.0
17+
oauthlib==3.2.2
18+
Pillow==9.4.0
2819
psycopg2==2.9.3
2920
pycodestyle==2.7.0
3021
pycparser==2.21
@@ -33,11 +24,10 @@ PyJWT==2.4.0
3324
python3-openid==3.2.0
3425
pytz==2020.1
3526
PyYAML==5.1
36-
requests==2.28.0
27+
requests==2.28.2
3728
requests-oauthlib==1.3.1
3829
sqlparse==0.3.1
3930
urllib3==1.26.9
4031
Werkzeug==2.1.2
4132
whitenoise==6.2.0
4233
zipp==3.8.0
43-

0 commit comments

Comments
 (0)