Browser DevTools: Your First Hacking Tool
Chapters and transcript
Browser DevTools Every modern browser has a built-in toolbox called Developer Tools, or DevTools. Developers use it to fix bugs. Security testers use it to see and change what a website really does. Today you will learn how to use it, and why a server must never trust what the browser sends.
The key tabs Press F12 to open DevTools, or Control, Shift and I on Windows. Five tabs matter most. Elements shows the live HTML, with hidden fields and comments. Console runs JavaScript. Network shows every request and response. Application, or Storage in Firefox, holds cookies. And Sources shows the JavaScript files, where API paths often hide.
Change anything With DevTools, a user can change almost anything in their own browser. They can re-enable a disabled button, change a hidden form field, such as a price, edit cookies and local storage, remove a length limit on an input, and resend a request with different data.
Never trust the client That leads to one of the most important rules in web security. The user edits values in their own browser. Then the changed request goes to the server. If the server trusts it, the user gets what they want. So remember: never trust the client. The server must check everything again.
Price tampering Here is a real-world pattern, on a practice checkout. The item costs twenty-five thousand. The price sits in a hidden form field. In the Elements tab, I change the hidden price to one, and click Buy now. The order goes through for one. The server trusted the price that came from the browser.
Cookie roles The same mistake happens with roles. This site decides who is an admin by reading a cookie that says role equals student. In the Application tab, I change it to role equals admin, and reload the page. The admin page opens, because the site trusted the cookie.
Quick check Quick check. A website needs to remember that a user is an admin. Where is the safest place to store that role? Think about what the user can change, then choose.
The fix Now the safe design. The browser sends an order that says price one. The server does not trust it. It looks up the real price in its own database, and gets twenty-five thousand back. Roles work the same way. The role stays on the server, linked to the session, so the user cannot change it.
The Network tab One more tip: the Network tab. I open it, then use the site normally. I click a request to see its headers, the payload that was sent, and the response. Look: the page only shows my name, but the response holds more data than the page shows. Testers always check.
Putting it together Let us put it together. DevTools lets you see and change everything in your own browser. Elements, Console, Network, Application and Sources are the key tabs. Hidden fields, disabled buttons and cookies can all be changed. So never trust the client: the server must check prices, roles and everything else again. Now read the lesson below, and try the labs.
Every modern browser includes Developer Tools (DevTools). Developers use them to fix bugs. Security testers use them to see and change what a website really does.
Open DevTools with F12, or Ctrl+Shift+I (Windows) / Cmd+Option+I (Mac).
The tabs that matter most
| Tab | What it shows | Why testers care |
|---|---|---|
| Elements | The live HTML of the page | Find hidden fields, disabled buttons, comments |
| Console | Messages and a place to run JavaScript | Test how the page reacts to your code |
| Network | Every request and response | See exactly what data is sent and received |
| Application (Chrome) / Storage (Firefox) | Cookies, local storage | Read and edit cookies and stored data |
| Sources | The JavaScript files | Find API endpoints, keys, and hidden logic |
Everything in the browser can be changed
With DevTools, a user can:
- Re-enable a disabled button
- Change the value of a hidden form field, such as a price
- Edit cookies and local storage
- Remove a
maxlengthlimit on an input - Resend a request with different data
This leads to one of the most important rules in web security:
Never trust the client. Anything that comes from the browser can be changed by the user. The server must check everything again.
A real-world pattern
Imagine a shop where the price is stored in a hidden field:
<input type="hidden" name="price" value="25000">
If the server trusts that value, a user can change it to 1 in DevTools and buy the item for almost nothing. The fix is simple: the server should look up the real price itself.
The same mistake happens with roles. If a website decides who is an admin by reading a cookie like role=student, the user can simply change it.
Tip: the Network tab
Open the Network tab, then use the website normally. Click any request to see:
- Headers: cookies, content type, authorization tokens
- Payload: the data sent
- Response: what the server returned. Sometimes it returns more data than the page shows.
In the labs, you will use DevTools to make yourself an admin, read data the page tried to hide, and change a price before checkout.
HANDS-ON LAB
Become Admin
The site decides who is admin by reading a cookie. Can you change it?
HANDS-ON LAB
The API Said Too Much
The page shows only your name. The API behind it sends much more.
HANDS-ON LAB
Name Your Price
The checkout sends the price from the browser. Will the server notice?
Check your understanding
Answer every question correctly to complete this lesson. If you miss one, try the quiz again.
1. Which DevTools tab shows every request the page makes?
2. A website disables a button with HTML. Is the action now protected?
3. What is the safest way to store a user's role, such as admin?
Locked: answer every quiz question above correctly to complete this lesson.
Spotted a mistake or something unclear? Report a mistake