Access control
PortSwigger Web Security Academy · Apprentice
- #Access control

Unprotected Admin Functionality
The vulnerability
The admin panel has no access control at all. The only thing hiding it is that nobody links to it, and robots.txt gives the path away.
Fix: Check on the server whether the user is an admin. A hidden path is not protection.
The lab
This lab has an unprotected admin panel. Solve the lab by deleting the user carlos.
Solution
1. Intercept the Main Page Request: In Burp Suite, go to Proxy -> HTTP history . Find the GET / request and right-click to Send to Repeater.
2. Discover the Admin Path via robots.txt: In Repeater, change the path to /robots.txt and send the request. Look at the response, which will disclose the /administrator-panel path.
HTTP/2 200 OK
Content-Type: text/plain; charset=utf-8
Set-Cookie: session=hjbNzyenDV0iB1tGUUrD87q5VaENsAot; Secure; HttpOnly; SameSite=None
X-Frame-Options: SAMEORIGIN
Content-Length: 45
User-agent: *
Disallow: /administrator-panelhtt
3. Access the Admin Panel: Change the path in Repeater to /administrator-panel and send the request. An HTTP/2 200 OK response confirms successful access.
4. Delete the Target User: Send a GET request to /administrator-panel/delete?username=carlos. The HTTP/2 302 Found response indicates the user has been deleted, and the lab is solved.
Unprotected Admin Functionality with Unpredictable URL
The vulnerability
Here the admin panel has a random path, so you can’t guess it. But the path is in the JavaScript that every visitor gets.
Fix: Check permissions on the server, no matter how hard the URL is to guess.
The lab
This lab has an unprotected admin panel. It’s located at an unpredictable location, but the location is disclosed somewhere in the application. Solve the lab by accessing the admin panel, and using it to delete the user carlos.
Solution
1. Intercept the Main Page Request: In Burp Suite, go to Proxy -> HTTP history. Find the GET / request and right-click to Send to Repeater.
2. Find the Hidden Admin URL: Review the response in Repeater. Look for a JavaScript snippet that reveals the unpredictable admin path, usually within an if (isAdmin) block, such as /admin-fndgcj.
<script>
var isAdmin = false;
if (isAdmin) {
var topLinksTag = document.getElementsByClassName("top-links")[0];
var adminPanelTag = document.createElement('a');
adminPanelTag.setAttribute('href', '/admin-fndgcj');
adminPanelTag.innerText = 'Admin panel';
topLinksTag.append(adminPanelTag);
var pTag = document.createElement('p');
pTag.innerText = '|';
topLinksTag.appendChild(pTag);
}
</script>
3. Access the Admin Panel: Change the path in Repeater to the found admin URL (e.g., /admin-fndgcj) and send the request. An HTTP/2 200 OK response confirms successful access.
4. Delete the Target User: Send a GET request to /admin-fndgcj/delete?username=carlos. An HTTP/2 302 Found response indicates the user has been deleted, and the lab is solved.
User Role Controlled by Request Parameter
The vulnerability
The application decides whether you are an admin by looking at a cookie. You can change that cookie yourself.
Fix: Keep the role in the session on the server, not in a cookie the user can edit.
The lab
This lab has an admin panel at /admin, which identifies administrators using a forgeable cookie. Solve the lab by accessing the admin panel and using it to delete the user carlos. You can log in to your own account using the following credentials: wiener:peter
Solution
1. Log In to the Application: Access the target website and log in using the provided credentials: wiener:peter.
2. Intercept Account Request: In Burp Suite, go to Proxy -> HTTP history. Find the GET /my-account?id=wiener request and right-click to Send to Repeater.
3. Modify the Admin Cookie: In Repeater, change the Admin cookie value from false to true in the request header.
GET /my-account?id=wiener HTTP/2
Host: 0ad5008d04257c40801277f900ef00fb.web-security-academy.net
Cookie: Admin=true; session=sl9EPTAGyJLv670WiiswlEoML8M1reUL
[…]
Send the modified request. The response should now indicate that the Admin panel is visible.
4. Access the Admin Panel: Change the path in Repeater to /admin and send the request. An HTTP/2 200 OK response confirms successful access to the admin panel.
5. Delete the Target User: Send a GET request to /admin/delete?username=carlos. The HTTP/2 302 Found response confirms the user has been deleted, and the lab is solved.
User Role Can Be Modified in User Profile
The vulnerability
When you update your profile, the server saves every field you send. If you add roleid, it saves that too, and you are an admin.
Fix: Only accept the fields a user is allowed to change.
The lab
This lab has an admin panel at /admin. It’s only accessible to logged-in users with a roleid of 2. Solve the lab by accessing the admin panel and using it to delete the user carlos. You can log in to your own account using the following credentials: wiener:peter
Solution
1. Log In to the Application: Access the target website and log in using the provided credentials: wiener:peter.
2. Change Your Email Address: Go to the “My Account” page and use the provided form to update your email address.
3. Intercept the Profile Update Request: In Burp Suite, go to Proxy -> HTTP history. Find the POST /my-account/change-email request and right-click to Send to Repeater.
4. Inject the roleidParameter: In the Repeater tab, add a new parameter to the request body: roleid=2. This value is usually associated with administrator privileges.
5. Verify Admin Access: Send a GET request to /admin. An HTTP/2 200 OK response confirms you now have administrative access.
6. Delete the Target User: Send a GET request to /admin/delete?username=carlos. The HTTP/2 302 Found response confirms the user has been deleted, and the lab is solved.
User ID Controlled by Request Parameter
The vulnerability
A classic IDOR. The account page shows whatever user is in the id parameter, without checking that it’s you.
Fix: Take the user from the session, or check that the requested account belongs to them.
The lab
This lab has an insecure direct object reference vulnerability. Solve the lab by accessing another user’s account and retrieving their API key. You can log in to your own account using the following credentials: wiener:peter
Solution
1. Log In to the Application: Access the target website and log in using the provided credentials: wiener:peter.
2. Intercept Account Request: In Burp Suite, go to Proxy -> HTTP history. Find the GET /my-account?id=wiener request and right-click to Send to Repeater.
3. Exploit IDOR to Access Another User’s Profile: In Repeater, change the id parameter in the URL from wiener to carlos (e.g., GET /my-account?id=carlos). Send the request.
4. Get the API Key and Solve the Lab: The response will display Carlos’s profile page. Find and copy the API key from the response body. Submit this API key as the solution to solve the lab.
User ID Controlled by Request Parameter, with Unpredictable User IDs
The vulnerability
The same problem as in the previous lab, except that the IDs are GUIDs. You can’t guess those, but the blog shows them next to each author.
Fix: Check permissions for every account, even if the ID can’t be guessed.
The lab
This lab has a horizontal privilege escalation vulnerability on the user account page, but identifies users with GUIDs. To solve the lab, find the GUID for carlos, then submit his API key as the solution. You can log in to your own account using the following credentials: wiener:peter
Solution
1. Log In to the Application: Access the target website and log in using the provided credentials: wiener:peter.
2. Intercept Your Account Request: In Burp Suite, go to Proxy -> HTTP history. Find the GET /my-account?id=YOUR-GUID request (where YOUR-GUID is your unique ID). Right-click to Send to Repeater. This GUID is unpredictable.
3. Discover Another User’s GUID: Navigate the application to find a feature that exposes other users’ GUIDs. For instance, click on a blog post by “carlos” and look at the URL. It will reveal Carlos’s GUID (e.g., /blogs?userId=3c2c3205–7952–4832-b7aa-5cf0e3815e6f).
4. Exploit IDOR to Access Carlos’s Profile: In Repeater, change the id parameter in your account request to Carlos’s GUID (e.g., GET /my-account?id=3c2c3205–7952–4832-b7aa-5cf0e3815e6f). Send the request.
5. Get the API Key and Solve the Lab: The response will now display Carlos’s profile page. Find and copy the API key from the response body. Submit this API key as the solution to solve the lab.
User ID Controlled by Request Parameter with Data Leakage in Redirect
The vulnerability
If you request someone else’s account, the application redirects you to the login page. The response with the redirect still contains the account data. The browser doesn’t show it, but Burp does.
Fix: Check permissions first and only then load the data.
The lab
This lab contains an access control vulnerability where sensitive information is leaked in the body of a redirect response. To solve the lab, obtain the API key for the user carlos and submit it as the solution. You can log in to your own account using the following credentials: wiener:peter
Solution
1. Log In to the Application: Access the target website and log in using the provided credentials: wiener:peter.
2. Intercept Your Account Request: In Burp Suite, go to Proxy -> HTTP history. Find the GET /my-account?id=wiener request and right-click to Send to Repeater.
3. Exploit IDOR with Data Leakage: In Repeater, change the id parameter in the URL from wiener to carlos (e.g., GET /my-account?id=carlos). Send the request.
4. Retrieve API Key from Redirect Response: Look at the response. Although it’s a HTTP/2 302 Found redirecting to the login page, the response body will briefly contain Carlos’s profile details, including their API key. Copy this API key and submit it as the solution to solve the lab.
User ID Controlled by Request Parameter with Password Disclosure
The vulnerability
The account page puts the current password into a masked field. Together with the IDOR in id, you can read the administrator’s password from the HTML.
Fix: Never send a password back to the browser, and check who is asking for the page.
The lab
This lab has user account page that contains the current user’s existing password, prefilled in a masked input. To solve the lab, retrieve the administrator’s password, then use it to delete the user carlos. You can log in to your own account using the following credentials: wiener:peter
Solution
1. Log In to the Application: Access the target website and log in using the provided credentials: wiener:peter.
2. Intercept Your Account Request: In Burp Suite, go to Proxy -> HTTP history. Find the GET /my-account?id=wiener request and right-click to Send to Repeater.
3. Extract Your Password (Demonstration): Look at the response in Repeater. Inside the HTML form for changing passwords, you’ll see your current password (peter) directly pre-filled in the value attribute of the password input field, despite it being masked in the browser.
[…]
<form class="login-form" action="/my-account/change-password" method="POST">
<br/>
<label>Password</label>
<input required type="hidden" name="csrf" value="ZYlvUhMOok6l2KT8iEIxYgdfC1esJtox">
<input required type=password name=password value='peter'/>
<button class='button' type='submit'> Update password </button>
</form>
[…]
4. Exploit IDOR to Disclose Administrator’s Password: Change the id parameter in the Repeater request from wiener to administrator (e.g., GET /my-account?id=administrator). Send the request. The response will now contain the administrator’s password pre-filled in the same manner. Copy this password.
5. Log In as Administrator and Solve the Lab: Log out of your current wiener account. Log in using the username administrator and the password you just obtained. Go to the admin panel (usually /admin) and delete the user carlos to solve the lab.
Insecure Direct Object References
The vulnerability
Chat transcripts are saved as 1.txt, 2.txt and so on. Anyone can download any of them, and one contains a password.
Fix: Check that the transcript belongs to the user who requests it.
The lab
This lab stores user chat logs directly on the server’s file system, and retrieves them using static URLs. Solve the lab by finding the password for the user carlos, and logging into their account.
Solution
1. Start a Live Chat: On the website, click on the “Live chat” feature. Type a message and send it.
2. View Chat Transcript: Click the “View transcript” button. This downloads your chat history.
3. Intercept Transcript Download Request: In Burp Suite, go to Proxy -> HTTP history. Find the GET /download-transcript/YOUR_TRANSCRIPT_ID.txt request (e.g., GET /download-transcript/2.txt). Right-click and Send to Repeater.
4. Exploit IDOR to Access Other Transcripts: In Repeater, change the filename in the URL to a lower number (e.g., from 2.txt to 1.txt) and send the request. The response should reveal a chat transcript from another user. Review the content for sensitive information.
HTTP/2 200 OK
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="1.txt"
X-Frame-Options: SAMEORIGIN
Content-Length: 520
CONNECTED: - Now chatting with Hal Pline -
You: Hi Hal, I think I've forgotten my password and need confirmation that I've got the right one
Hal Pline: Sure, no problem, you seem like a nice guy. Just tell me your password and I'll confirm whether it's correct or not.
You: Wow you're so nice, thanks. I've heard from other people that you can be a right ****
Hal Pline: Takes one to know one
You: Ok so my password is 60dey1ge0m5gnrw4wvyu. Is that right?
Hal Pline: Yes it is!
You: Ok thanks, bye!
Hal Pline: Do one!
5. Log In as Carlos to Solve the Lab: Continue changing the filename (e.g., 3.txt, 4.txt, etc.) until you find a transcript containing the username “carlos” and a leaked password. Once you have Carlos’s credentials, log out of your current account and log in using “carlos” and the found password to solve the lab.