diff --git a/pygoat/db.sqlite3 b/pygoat/db.sqlite3 index c6fc9d9bd..5104abc20 100644 Binary files a/pygoat/db.sqlite3 and b/pygoat/db.sqlite3 differ diff --git a/pygoat/introduction/mitre.py b/pygoat/introduction/mitre.py index 2f43bca40..dfc0d4821 100644 --- a/pygoat/introduction/mitre.py +++ b/pygoat/introduction/mitre.py @@ -6,9 +6,16 @@ import datetime from .models import CSRF_user_tbl from django.views.decorators.csrf import csrf_exempt +# import os ## Mitre top1 | CWE:787 +# target zone +FLAG = "NOT_SUPPOSED_TO_BE_ACCESSED" + +# target zone end + + @authentication_decorator def mitre_top1(request): if request.method == 'GET': @@ -198,7 +205,17 @@ def csrf_transfer_monei_api(request,recipent,amount): return redirect ('/mitre/9/lab/transaction') -@authentication_decorator +# @authentication_decorator @csrf_exempt def mitre_lab_25_api(request): - pass \ No newline at end of file + if request.method == "POST": + expression = request.POST.get('expression') + result = eval(expression) + return JsonResponse({'result': result}) + else: + return redirect('/mitre/25/lab/') + + +@authentication_decorator +def mitre_lab_25(request): + return render(request, 'mitre/mitre_lab_25.html') \ No newline at end of file diff --git a/pygoat/introduction/templates/mitre/mitre_lab_25.html b/pygoat/introduction/templates/mitre/mitre_lab_25.html new file mode 100644 index 000000000..de08fdd92 --- /dev/null +++ b/pygoat/introduction/templates/mitre/mitre_lab_25.html @@ -0,0 +1,47 @@ +{% extends "introduction/base.html" %} +{% load static %} +{% block content %} +{% block title %} + Code Injection +{% endblock %} +
+

Calculator

+
+
+ + +
+ +
+
+
+ + +{% endblock %} \ No newline at end of file diff --git a/pygoat/introduction/templates/mitre/mitre_top25.html b/pygoat/introduction/templates/mitre/mitre_top25.html index 538dc33ef..d0653f830 100644 --- a/pygoat/introduction/templates/mitre/mitre_top25.html +++ b/pygoat/introduction/templates/mitre/mitre_top25.html @@ -32,7 +32,7 @@

CWE-94: Code Injection

This lab have a calculator with can compute simple arithmetic operations. Try to exploit that

-
diff --git a/pygoat/introduction/urls.py b/pygoat/introduction/urls.py index af9dabc13..afd1418df 100644 --- a/pygoat/introduction/urls.py +++ b/pygoat/introduction/urls.py @@ -113,4 +113,5 @@ path("mitre/9/lab/transaction",mitre.csrf_transfer_monei,name="csrf_lab_login_api"), path("mitre/9/lab/api//",mitre.csrf_transfer_monei_api,name="csrf_lab_login_api"), path("mitre/25/lab/api", mitre.mitre_lab_25_api, name="mitre_lab_25_api"), + path("mitre/25/lab", mitre.mitre_lab_25, name="mitre_lab_25"), ] diff --git a/pygoat/pygoat/settings.py b/pygoat/pygoat/settings.py index 769300daf..bfdfc63d9 100644 --- a/pygoat/pygoat/settings.py +++ b/pygoat/pygoat/settings.py @@ -165,4 +165,4 @@ } SECRET_COOKIE_KEY = "PYGOAT" -CSRF_TRUSTED_ORIGINS = ["http://127.0.0.1:8000","http://0.0.0.0:8000","http://172.16.188.81"] \ No newline at end of file +CSRF_TRUSTED_ORIGINS = ["http://127.0.0.1:8000","http://0.0.0.0:8000","http://172.16.189.10"] \ No newline at end of file