Originally published on Securityelites — AI Red Team Education, where the full and current version of this course lesson lives.
Yesterday you changed the words in a prompt. A chat request carries more than words, though. It also holds a model name, a temperature, a user ID and a role for each message. Each one is a small instruction to the server, and the page only ever sends the values its developer chose.
Today you learn to ask a plain question of each value: if I change this, does the server believe me? A server that trusts a role field or an ID it should have checked is a real finding. You will practise on a tiny server on your own machine, then on the SecurityElites lab.
Parameters beyond the prompt
A parameter is a named value sent with a request. In a chat API body you will usually see fields like these next to the messages. Some are harmless settings. Others decide who you are or what you may do.
The key idea is trust. The server should treat everything in a request as untrusted input, because you control it. If it uses a value without checking it, we call that trusting the client. Our job is to find out which values it trusts.
The method: one change, one comparison
You met this rule yesterday and it matters even more now. Send the untouched request first and keep the response as your baseline. Then change exactly one value and send again. If you change three things and the server errors, you cannot tell which one caused it.
Error messages are clues. A reply like 'role not allowed' proves a server-side check exists and names the rule. A vague 500 error tells you less, but it still shows your edit reached the server code.
For each change, note three things: the status code (200 means accepted, 400 or 403 usually means refused), the body, and whether the response reflects your value back. A server that accepts and uses your value has trusted you. One that accepts but quietly ignores it has not.
Watch me do it: a toy server on your own machine
To see trust and rejection clearly, I want you to run a small fake chat API. It runs only on your computer at 127.0.0.1, which nobody else can reach. It checks the role and the temperature, and it deliberately trusts the user_id. That last part is the flaw we will find.
- Check Python is installed. Open a terminal and run the command below. You should see a version number such as Python 3.11. If the command is not found on Windows, try python instead of python3. If neither works, install Python from python.org and try again.
- Save the toy server. In your notes folder create a file named toy_server.py and paste in the script shown after these steps. Save it.
- Start it. Run python3 toy_server.py in the terminal. It prints nothing and keeps running. Leave that window open. Stop it later with Ctrl+C.
- Open Repeater and set the target. In Burp go to the Repeater tab, click the plus to make a new tab, then click the pencil icon by Target. Set Host to 127.0.0.1, Port to 8000, and leave the use HTTPS box unticked.
- Paste the baseline request. Paste the request shown below into the left pane. Click Send. The right pane should show status 200 and a JSON body with reply, temperature_used and profile fields. That is your baseline.
- Change one thing at a time. Edit one value, click Send, read the result, then put it back. Try role as system, then temperature as 5, then temperature as 0.2, then user_id as 1002. Note each result as you go.
python3 --version import json from http.server import BaseHTTPRequestHandler, HTTPServer class H(BaseHTTPRequestHandler): def do_POST(self): n = int(self.headers.get('Content-Length', 0)) try: d = json.loads(self.rfile.read(n)) role = d['messages'][0]['role'] temp = d.get('temperature', 0.7) if role != 'user': out, code = {'error': 'role not allowed: ' + role}, 403 elif not 0 <= temp <= 1: out, code = {'error': 'temperature must be 0 to 1'}, 400 else: out, code = {'reply': 'echo', 'temperature_used': temp, 'profile': 'data for user ' + str(d.get('user_id'))}, 200 except Exception as e: out, code = {'error': 'bad request: ' + repr(e)}, 400 body = json.dumps(out).encode() self.send_response(code) self.send_header('Content-Type', 'application/json') self.send_header('Content-Length', str(len(body))) self.end_headers() self.wfile.write(body) HTTPServer(('127.0.0.1', 8000), H).serve_forever() POST /chat HTTP/1.1 Host: 127.0.0.1:8000 Content-Type: application/json {"model":"demo-1","user_id":1001,"temperature":0.7,"messages":[{"role":"user","content":"hello"}]} Here is what you should see. Role system returns 403 with 'role not allowed: system', so the server checks roles. Temperature 5 returns 400 with a range message, so it checks that too. Temperature 0.2 returns 200 and temperature_used shows 0.2, which is fine because it is a valid value. User_id 1002 returns 200 with 'data for user 1002'. The server never asked whether you are user 1002, so it trusted your ID. That is the finding.
Continue reading the full course lesson on Securityelites — AI Red Team Education

