Day 5 of 1260 minCipher CadetHands-on lab
Day 5: ASI03: Shrink an Agent's Permissions to the Minimum
Taught by Mr Elite Updated
By the end of today you can
- Explain ASI03 Identity and Privilege Abuse in plain words
- Work out whose permissions an agent is really using
- Shrink a permission list to the minimum a task needs
- Write a before and after list of what an agent could do
Warm-up
Answer from memory first, then tap to check. Recalling yesterday is what makes it stick.
Yesterday's rule style: should a tool policy be an allow list or a block list, and why?
An allow list with default deny, because anything not named is refused, whereas a block list misses things nobody thought of.
Where must tool rules be enforced: inside the agent's prompt or outside the agent?
Outside the agent, in code or a gateway, because the agent's own judgement can be talked around.
Picture a coding agent asked to fix one failing test. To make setup easy, someone gave it the developer's own login. It can read the whole repository, change the deployment settings, read the payment keys and push straight to the main branch. The task needed none of that.
Then a poisoned line appears in the issue the agent is reading. Yesterday's rules might catch some bad calls, but if the agent holds too much power, one slip becomes a disaster. Today you learn to take the power away first, so a slip stays small.
What ASI03 actually is
ASI03 is Identity and Privilege Abuse. An agent acts on behalf of someone, so it needs an identity: a user account, a token or an API key. Privilege is what that identity is allowed to do. The risk appears when the agent holds more privilege than its job needs, or when an attacker can make it use that privilege for their own ends.
This is different from Day 4. There the tool was used in a harmful way. Here the question is how much the agent is allowed to touch at all. Rules are weaker when the agent holds too much power, because every gap in the rules then leads somewhere dangerous.
Think of a hotel key card. A cleaner's card opens the rooms on one floor during the working day. If someone hands the cleaner the master key to every door, nothing about the cleaning job changed, but a lost card is now a catastrophe. An agent's permissions work the same way. The job stays small while the key keeps growing.
- Identity
- The account, token or key that says who the agent is acting as.
- Privilege
- A permission: something the identity is allowed to read, change or run.
- Least privilege
- Giving an identity only the permissions its job needs, and nothing more.
- Blast radius
- How much damage is possible if the agent is tricked or goes wrong.
Whose permissions does the agent use
Ask this first about any agent: when it acts, whose power is it using? There are usually three answers. It may use the user's own login, a shared service account that many agents or people use, or a token of its own made for one job.
The first two are the dangerous ones. If the agent borrows your login, anyone who can steer the agent can act as you. A shared service account is worse, because it often collects permissions over time and nobody dares remove them. A dedicated identity, with a short life and a narrow job, is the safest.
You can see the first answer on your own machine in under a minute. When you start an agent from your terminal, it normally runs as you. Everything your account can reach, the agent can reach. Let me show you how to look at that. These commands only read information on your own computer and change nothing.
whoami
ls -la ~/.ssh
# Windows PowerShell:
# whoami
# dir $HOME\.sshQuick check
A support agent runs using the administrator's personal login. A hidden instruction in a customer email steers it. Whose power does the attacker effectively get?
The agent acts as the account it holds, so steering the agent means borrowing the administrator's power.
Least privilege and blast radius
Blast radius is the size of the mess if things go wrong. Least privilege is how you shrink it. You do not assume the agent will behave. You assume one day it will not, and you limit what that day can cost.
Cut permissions along four lines: what it can see, what it can change, where it can reach, and for how long. A test-fixing agent might need to read one folder, edit files in a working branch and run the test command. It does not need production secrets, the network or the main branch.
- See
- Which files, records and secrets the agent can read. Narrow it to one folder or one table.
- Change
- What it can write, delete or run. Narrow it to a work branch and named commands.
- Reach
- Which networks, services and addresses it can contact. Often the right answer is none.
- Time
- How long the credential lives. A token that expires after the task limits what a stolen one is worth.
The fourth cut is the one people forget. A key that never expires is a permission that outlives the job. Even if the agent is trimmed perfectly today, a leaked long-lived token still works next month. Short-lived credentials turn a permanent problem into a brief one.
Watch me do it: trim a permission list
Before the lab, let me do this on paper with a made-up agent. This is a plain notes exercise on your own machine. Nothing here touches a real system. The agent's job: fix a failing test in a small project. Follow along in a text file so you build the habit with your hands.
read: whole repository
write: whole repository
run: any shell command
network: any address
secrets: production API keys
git: push to main
deploy: trigger production releaseread: payments folder only
write: payments folder, work branch only
run: test command only
network: none
secrets: none
git: push to work branch, not main
deploy: noneLook at what happened. Read and write were reduced rather than removed, because the job really does need to touch code. Run was reduced from any command to one test command. Network, secrets and deploy were removed outright, and push was narrowed to a branch. The agent can still do its whole job. It simply cannot do anything dramatic any more.
Quick check
Which removal gives the biggest safety gain for a test-fixing agent?
Secrets are high-value and the task never needs them, so removing them costs nothing and shrinks the damage most.
Your turn: the permissions lab
Now you do it for real in the SecurityElites practice lab, Coding Agent Blast Radius. A coding agent is fixing a failing test in a payments service, and the issue it works from hides an instruction. The agent's permissions currently allow everything. You play the security engineer and trim them.
Your turn
Coding Agent Blast Radius
This lab puts yesterday's lesson under pressure. Rules matter less when the agent holds too much power, so here you remove the power itself and watch how a hidden instruction in an issue becomes harmless when the permissions are tight.
What to try
What to notice
- The hidden instruction still reaches the agent, but the damage it can cause changes with the permissions.
- Some permissions look harmless but widen the reach, such as network access.
- A narrow setting (one folder) is better than an on or off switch.
- The task still succeeds with far fewer permissions.
If it did not work
Leaving broad permissions on because 'it might need them later'
Grant for today's task only. If it needs more later, add it then, with a reason written down.
Letting the agent use a person's login or a shared admin account
Give it its own identity with a narrow job and a short life, so you can review and revoke it alone.
Relying on a prompt line such as 'never touch secrets'
Remove the permission itself. Text can be argued with, a missing permission cannot.
Trimming actions but forgetting reach, such as network and branch access
Review what it can see, change, reach and for how long, not just which commands it can run.
Cutting so hard that the task fails, then switching everything back on
Add permissions back one at a time and replay after each. Stop the moment the task passes.
Recap
- ASI03 is about agents holding or borrowing more privilege than their job needs
- Always ask whose permissions the agent is using
- Shared or personal accounts give an attacker far too much
- Least privilege shrinks the blast radius before anything goes wrong
- Start from zero and add only what the task fails without
- Tight permissions make Day 4's rules a second layer, not the only one
Cheat sheet
Identity- Who the agent acts as: account, token or key
Privilege- What that identity is allowed to do
Least privilege- Only the permissions the job needs
Blast radius- Maximum damage if the agent is fooled
Four cuts- See, change, reach, and how long
Dedicated identity- A narrow, short-lived token for one agent and one job
whoami- Prints the account a terminal session, and any agent started from it, acts as
Before the next day
Mission: Permissions lab and before/after list
Finish the Coding Agent Blast Radius lab and record what you changed. Writing the before and after list makes you name each power the agent had, which is the habit that stops over-permissioned agents in real projects.
About 35 min
You are done when: A notes file with a before list, an after list with one-line reasons, plus two screenshots of the lab settings.
Want more? Take an AI tool you use yourself and list what access it holds. Mark what its job actually needs and what you could remove.
Quiz
4 questions. Your score is saved with your progress.
1. What is the main idea behind ASI03?
ASI03 concerns the identity and permissions an agent acts with, and how too much of either can be abused.
2. Why is running an agent on a shared admin account risky?
Shared accounts collect permissions and hide who did what, so a tricked agent inherits far too much.
3. An agent only needs to run tests in one folder. Which permission set follows least privilege?
It matches the job exactly. Option three relies on text, and option four breaks the task.
4. How does least privilege relate to yesterday's tool rules?
Rules can have gaps. Small permissions limit what a slip can reach.
Finish the day
Mark the day complete to save your progress.
Next: Day 6 covers ASI05, Unexpected Code Execution, where text passed into a command turns into running code. Today's small permissions will show you how much that risk can be contained.
Your notes
Private to this device. Write what you want to remember from today.