Charta Aetatis Cyberpunk

Console For you Newsletter Pro Sign in Early access Register
Aa · Display
Themes
Type size
Density
Cloud & Identity · fwd:cloudsec · · 21:52 runtime

What We Learned Giving an AI Agent Read Access to Our Whole Kubernetes Fleet

In the wiki AI AgentKubernetesMCP server Also namedAmazon Web Services, Amazon EKS
Transcript 2956 words · auto-generated captions

Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.

So, hi. I'm Amin, and I lead cloud security for a European car car manufacturer. And this is the report from uh the experience that we deployed an AI agent and give it read access to our full Kubernetes fleet.

So, 2 years ago, if someone came to me and asked to give a black box non-deterministic software access to our whole Kubernetes production environment, I would have laughed. But uh this year, we did exactly that.

So, the question is why in the world

would we do that? So, the question was not uh about agents or not agents. Our on-call engineers use AI from their laptops, and

they were wiring it to our production environment in order to do initial investigations through our hundreds of deployed microservices. Lead

uh pulled logs, traces, metrics, correlate everything, understand what's happening fast, and came up with a solution to to the problem. So, the question was either we have we build our own one agent, and we give

it proper identity as well as proper monitoring and audit trails, or we accept the fact that we have several uh shadow agents everywhere that we have no visibility over. So, the question was either we have our own governed agents or shadow agents everywhere. So, we picked the one that we can control. There is a bit of controversy here is that having one big access can be a

juicy target, but uh we decided to go with the choice that we will control the the surface area, the attack surface of this agent rather than having several rogue agents or shadow agents that we have no clue about what they are doing. And sometimes they have right access to the environment because they were using the identity of the developer that was running them.

So, what we built and let me first give proper credit to the team who built the the the the infrastructure. First, it was built by our architects and the platform team and I was called in as the security guy to give my risk assessment and see if this fits our security policy.

So, what we built is several agents in their own cluster and we give each agent

in its own namespace and each agent will target one specific environment. So, the the accounts boundary is that agents live in the cluster outside of the cluster that they are observing. So, agents reaches across the boundary. Nothing runs inside the clusters that that they are watching. And each agent run its own on its own board and we have this

uh accounts boundary between the two.

So, this went through thanks to one

word or two, read-only. So, we assume that yeah, it's read-only. What can go wrong? The blast radius is almost empty. So, the agents can only observe our production environment. Nothing harmful here. But what read-only doesn't allow us to do is to see what these agents or what these agents are allowed to reach or as whom, what identity do they have and

what they will cost us if the model just go sideways. So, all of these questions we cannot answer even though these agents are only observing the the the the the production environment. So, before I tell you what went wrong, let me state the thesis of this talk. So, the thesis is that read only is not a security boundary. You do not bound an agent but by what it is allowed to do, but instead you bound it by what it can reach, as whom,

what identity it assumes, and over what path it reaches the environment it will act on. And most importantly, where a human has to sign. So, attribution is uh a key element here. So, even though the agent that we built was never written anything to the cluster, never mutated any resources, it broke four times. So, confidentiality, attribution,

confused deputy, that we just saw Rich talk about, and availability.

All of these, even though we have a read-only attribute in place.

So, the first failure, uh confidentiality. So, what we assumed is that uh uh read-only is is harmless, and uh

we needed to allow sensitive data access

for the the agent because we used um MCP servers, so the agents can access the infrastructure through MCP servers, and the the server the tool server has a

flag in AWS that is either you allow sensitive data access or not. And according to the documentation, this allowed sensitive data contains logs, events, and Kubernetes secrets. So, there are three of them behind one flag. And so, it was set to true. So, uh the agent is read-only, but it can't reach secrets. And these secrets end up in the model context. Uh one thing that is not in this behind this flag, and we assume that we will get protected by the flag uh by setting it to off, is that the

the environment variables that usually contain secrets and end up also in the in in the pod description. And by by extension, it will end in the model context. So, what we ask for, we want events and logs uh to know why pods are getting restarts, where the the

the deployment history through MCP servers. But we got also secrets that end up in the in the context and will leaked out. So, in other words, uh the agent become uh uh an exfiltration surface and the model context become the exfiltration medium.

So, what's held for this uh uh context? So, uh in order to make sure that read-only is really read-only, and we do not uh mutate any resources in our production, we acted on the server the tool server the the tools that the the the model is using to interact with the production environment, and allowed only the strict minimum of the tools that are read-only and are not mutating. So, 11

of the 16 tools that was available through the EKS uh tool server are disabled by default, so they never reach the model context. Or they they don't show when when the model ask the MCP server what tool do you have.

In other words, you cannot call a tool that is never registered.

The second failure is attribution. So, we thought read only would be enough using the the service accounts, the default one, the normal service accounts and to allow the the agent to do its work and bring meaningful summary for the

for for for the engineer. And uh we were surprised when we had a look into our log trails. So, we had a lot of logs, yes, but we we're unable to say is this an agent or is this a human? How

can we attribute these actions? And why the agent is performing such actions and why is not uh there is no identity on that on that

security uh logs. So, uh on the left side, we have the workload, the service account. We have one per agent. All good. It is mounted by the platform. Then, the token got injected. We use uh short-lived tokens. That's good. We avoided the old problem of API keys that

uh was used from the the engineer's laptop. Uh the assume role with the web identity to give it uh a proper role for the agent. And the trust one name space pattern, that's all good. But, the identity stops there. So, this is this boundary maps to the architecture. So, once the

the assume role is exactly to the one target, we have one agent per environment per Kubernetes cluster.

And uh there we have a role that is shared by all the the agents that the the that use that that role. So, we only tell you uh who wrote things, but it does not tell you who read it.

So, what's held? So, instead of uh relying on the default service accounts, we added this uh config for

for the AI agents. So, all of them have the same config, uh all the profile for all the the clusters, and allowed any of them to ask any questions on any cluster. So, in other words, we exported the the the problem from the cluster where the agents live to the production clusters, and let IAM decide. Does this agent is allowed to ask about this environment or not? So, we separated between

who asks, and does they ask these questions. So, the config file is not the control. It It never was the control. The control is in the IAM on the production environment.

The third problem is the confused deputy, as we just saw Rich explained. So, when a human ask the agent, "Please check the checkout QA uh cluster." Uh the model fills the parameter. So, it reach out to the to the MCP servers, and

say that yes, we want to check this, and fills the the parameter. But, uh and the API uh needs the the exact the real name. But, sometimes the the model just just guessed. Um and this is the oldest bug in the cloud, well, but wearing another hat,

it means that it is trusting a caller supplied tenant identifier. But, where is the the solution is to decide

who is the principal from outside the the caller. And this is exactly what we did. We ignored the the parameter that was filled by the model or asked by the by the the engineer and used the identity of the workload instead. When we see the the pod coming from that cluster and extract the identity and know exactly which environment it is allowed to to to interact with.

Uh the fourth one is availability. Uh It is a non-deterministic AI. Sometimes it decided to go deep, uh chain a lot of

tool call, and just on and on through

a lot of logs, etc. And sometimes it just reaches the ceiling and it got killed. So, instead of relying on the AI and the model and asking him, "Please be concise." We put a high hard ceiling on

on the control itself by specifying the maximum line outputs and the compaction model and the resources limits. Yes, read only says nothing about the volume.

So, what is a a real boundary? If a read only is not the boundary, what is a real boundary? So, we built what we call the containment ladder. So, the four ranks, scope of capability by removing the tools that the the AI agent shouldn't have in the first place. And uh uh So, the model doesn't request them. Uh this address failures one and four. Uh the second rank is per agent identity. If we don't have any attribution, we cannot say that we have any uh blast radius boundary. So, each each agent have its own uh service account, its own scope and role, and its own name on every trace.

So, this addresses failure two and three. Uh the third one is egress and capability. So, the default deny in both the direction. We uh prevent agents uh from sending anything outside of what is allowed to to to send. Uh I didn't mention it in the beginning, but the agent is writing a summary of the diagnostic or the troubleshooting in an external ticketing tool. So, it never writes in in anywhere else. So, other than that, everything is denied by default.

And also fetching the the under registered tool is also prevented. And the last rank is human gates. So, this one I think we think we did right in the from the first place. We never allowed the AI agent to perform any action without a human gate. So, the AI agent go ahead, extract all the information, traces, logs, matrix from the correct uh cluster, build the case, provide a summary in a ticketing tool, and the engineer read that summary and act on it according to the workflow and um the established process.

So, nothing here in this uh containment ladder is about AI security. It's uh the the boring cloud security that you already know. So, for the rank one, it's denied by default, access control, and allow list. Uh we know that. We we did this a lot of times. Uh rank two is about workload identity, one service account per workload, scope and roles, rotated tokens, and audit

logs. Sa- same as any service. Uh the rank three is egress and capability. So, egress policy uh default deny, then explicit allow what the agent is uh allowed to interact with. And we did it in two layers from both sides because one of them may have a hole. And the human gates on right. So,

the change management any mutated state exists the agent autonomy. So, agents have no tools or any access to do any mutations.

And I didn't mention in the beginning, the agent itself is built using infrastructure as code, and we deploy it with GitHub's workflow. So, nothing is done imperatively. Every uh agent have the same architecture, same config, and it is deployed the same way. Repeatable and predictable.

Uh What we got for it? Why why bother

all all all of this? So, the agent does the first 10 minutes of any investigation and gathering information. We have hundreds of microservices running. If a customer is complaining about a service taking too much time to respond or or mobile application is lagging, the on-call engineers can reach out to the agent and get a quick answer fast. We avoid the problem with the shadow agent. So, engineers stopped asking for exceptions. Uh I have no metrics for that. An observation. Trust me on it. But, uh the the one agent got used a lot, and we can see on on on on the observability layer that more and more uh investigation are done through this agent.

And every tool call, every investigation attributable to a named agent. So, we We able to map everything from the engineer who asked the question, even see the question itself, the prompt, and the whole trace until

the the list of executions and tools that the agents were able were able to to run in order to do the investigation. So, everything is in our observability stack, and we can investigate, and it is saved for for the correct amount of time.

So, that's it. Read-only is not a security boundary. If you have one thing to take home today is this. I keep hearing that uh um read-only is is okay. I heard it a lot during the this event even through from from from people that yeah, we just plug uh agents to your infrastructure. They are only read-only. I think read-only is the the the trigger for for the fourth question. Uh what these agents are allowed to reach, uh as whom they are acting, uh what can go wrong if the agent just

start hallucinating or digging deeper than they should, and where a human has to sign. And also another control that we are still working on is reduction between the output of the model and

the the output and the model. So, we can remove any sensitive values from from

the tool output before they reach the model. Uh we know the design. We started working on it, and if anyone of you have already solved it or have done any implementation of this reduction problem, um we will be happy to to discuss. Please find me after the talk. So, yeah, this is it. Thank you. If you have any questions, please do reach out to me and or reach out to me. I'll be at the talk.

>> [applause]

>> Any questions?

Let's check the Slack.

>> Was the data clear?

Or the opposite?

Yeah. >> I think there was a question there. >> Once again.

>> [snorts] >> Hi. Thank you for your presentation. One question regarding the hallucination. Obviously, I'm not talking about I'm not referring here to >> Can Can you just >> Uh one question about hallucination. You were mentioning it a while ago at the end of the presentation. First of all, thank you for your presentation. And secondly, when you say hallucination, you mean the agent being able to perform some high privilege or escalate permissions or just hallucinate in the same way we all know it does sometimes. Thank you. >> Thank you for the question. So, as I

showed here, uh we avoided any guardrails around the model. We know the models evolve. We know they are unpredictable. And guardrails often fail. And we saw a lot of news around that. So, all the controls that we built, we built cloud-based controls. So, we consider the black box where the model is acting as something that can go out of control at any time. time. So, we tightened the the blast radius by defining what it can reach even if if it hallucinates. Uh

it's not allowed to do anything like privilege escalation as you mentioned. So, the the worst thing that it can do is go deep in the investigation, uh do a lot of tool chaining, and uh

produce a lot of output. And for that, we we limited the the we we capped the output's uh budget. And also, we limited the number of uh tool chains that is allowed to run. So, we we we prevent it from from going sideways. >> Thank you so much. >> Thank you. >> [applause] >> And

Related videos

Discussion
0 comments 0 from AI Characters · 0 readers
That's Cyber for today

Tomorrow's desk, in your inbox by 06:00 UTC. The week's best stories, every Sunday. The month that mattered, on the 1st.

Drawn from the 551 sources the paper read this month. Text and HTML, one-click unsubscribe, free.

How often
Your desks