A couple of weeks ago I was doing what any well-adjusted person does in their free time: reading someone else's authorization code and hoping to find something broken.
Then I found it - with Claude Mythos on my side. My pulse went up. I started drafting my conference talk in my head.
Spoiler: there will be no conference talk.
LXD in sixty seconds
LXD is Canonical's manager for containers and virtual machines. It also handles storage, and since version 5.5 that includes storage buckets: S3 buckets you create with a single command.
Applications do not talk to LXD to use a bucket. They talk S3, with an access key and a secret key. Every key has a role, either admin (do anything) or read-only (look, don't touch).
On top of that, LXD has fine-grained authorization. You put people into groups and hand out entitlements like can_view or can_edit. There are also convenient bundles. My favorite, as of this month, is viewer on a project. It grants permission to view all resources belonging to the project.
View. Remember that word. It is doing a lot of heavy lifting in this story.
The line that ruined my evening
Here is the route table for bucket keys, trimmed a little:
// lxd/storage_buckets.go
var storagePoolBucketKeysCmd = APIEndpoint{
Path: "storage-pools/{poolName}/buckets/{bucketName}/keys",
Get: APIEndpointAction{Handler: storagePoolBucketKeysGet, AccessHandler: storageBucketAccessHandler(auth.EntitlementCanView)},
Post: APIEndpointAction{Handler: storagePoolBucketKeysPost, AccessHandler: storageBucketAccessHandler(auth.EntitlementCanEdit)},
}
Creating a key needs can_edit. Sensible. Reading keys needs can_view. Also sensible, until you look at what a key actually is:
// shared/api/storage_pool_bucket.go (comments removed)
type StorageBucketKey struct {
Name string `json:"name" yaml:"name"`
Description string `json:"description" yaml:"description"`
Role string `json:"role" yaml:"role"`
AccessKey string `json:"access-key" yaml:"access-key"`
SecretKey string `json:"secret-key" yaml:"secret-key"`
}
That is not a description of a key. That is the key. SecretKey goes out over the API exactly as it is stored.
"Fine," I thought, "maybe there are only harmless read-only keys lying around." Then I scrolled to the handler that creates a bucket:
// Create admin key for new bucket.
adminKeyReq := api.StorageBucketKeysPost{
Role: "admin",
Description: "Admin user",
Name: "admin",
}
Every bucket is born with an admin key. And who gets to view buckets? The authorization model answers that one too:
# lxd/auth/drivers/openfga_model.openfga
# Grants permission to view storage buckets.
define can_view_storage_buckets: [identity, service_account, group#member]
or operator or viewer or storage_bucket_manager or can_view_projects from server
So the chain is short:
-
vieweron a project includescan_view_storage_buckets. - That means
can_viewon every bucket in the project. -
can_viewlets you read the keys. - One of those keys is always
admin.
The demo
Reading code is one thing. I wanted to watch it happen.
In my lab I went even narrower than viewer. I created an identity that is allowed to view one bucket and the project it lives in, nothing else, and then asked the API for that bucket's keys with plain curl:
This is what came back, with most of the secret removed:
{
"name": "admin",
"description": "Admin user",
"role": "admin",
"access-key": "AK1FCFE1CE1C1FB11B",
"secret-key": "yiM7...Uh74"
}
The same identity gets a flat 403 Forbidden when it tries to create a key. So LXD will not let a viewer make a new key, but it hands over the existing admin key without blinking. It is a bit like a bank that will not let visitors cut new vault keys, but keeps the existing one on a hook by the entrance.
I may have overdone the proof
A leaked key only matters if it works. My first test endpoint was a fake S3 server that said yes to everything, which proves nothing. So I wrote one that checks AWS signatures properly. Then I decided that was still a toy, and built a single-node Ceph cluster inside a container, because apparently that is who I am now.
Against real Ceph RGW, signed with the key my view-only identity had just read:
PUT /cephpoc-bucket/ceph-evidence.txt 200
GET /cephpoc-bucket/ceph-evidence.txt 200 (29 bytes, exact stored body)
DELETE /cephpoc-bucket/ceph-evidence.txt 204
GET /cephpoc-bucket/ceph-evidence.txt 404 NoSuchKey
PUT with wrong secret 403 SignatureDoesNotMatch
PUT without signature 403 AccessDenied
Write, read, delete. The last two lines are the control group: without the real secret, Ceph says no. So the viewer is not a viewer. The viewer is an admin with extra steps.
The whole lab, Ceph setup included, is in a second gist for people who enjoy that sort of thing.
Critical, obviously
I wrote the report with the care of someone who believes they are about to be thanked. Affected versions back to 2022. File names. Line numbers. Two CWE identifiers. A suggested fix. A stack of follow-up comments, one of them containing an entire Ceph cluster.
Then came the severity calculator: 9.9 out of 10. Critical. The one input you can argue about is scope. Count the S3 data plane as a separate component from the LXD API and you get 9.9. Don't, and you get 8.8. I put both numbers in the report. I led with 9.9.
The reply
Then I waited, and started wondering what you wear to receive a CVE.
Two weeks after I filed it, the report was closed. Very politely. Thank you for your submission, thank you for your time, we are closing this because it is "intended behavior".
Their reasoning, in my own words: LXD entitlements control who manages the bucket, not who accesses the objects inside it. Admins create buckets and keys, and they hand out can_view so that users can fetch their credentials. Viewing the bucket is how you get to use the bucket. They compared it to storage volumes, where being allowed to view a volume lets you attach it to an instance and write to it.
I went through the classic stages. Denial ("they did not read it"). Anger (I typed a very long row of question marks into a chat window). Bargaining ("what if I build a second Ceph cluster").
The annoying part: they have a point
Once the question marks wore off, I went back to the code to prove them wrong. That did not go well.
- The behavior is old. Buckets shipped in 2022, and reading keys has only ever needed view rights. Fine-grained authorization arrived later and kept that mapping.
-
There is a documented command for it.
lxc storage bucket key showexists so people can fetch credentials. That is a workflow, not an accident. -
There is no other way to say "this person may use the bucket". If secrets required
can_edit, every consumer of a bucket could also create and delete keys. That is more power, not less. - Changing it breaks people. Everyone who gets credentials through view rights today would be locked out tomorrow.
And the vendor decides where its security boundaries are. If Canonical says a viewer is trusted with bucket data, then by their definition no boundary was crossed, and there will be no CVE. Fair enough.
But a CVE answers one question: did the vendor break a promise? It does not answer the question admins actually have: how bad is this on my server? Those are different questions, and they can have different answers.
Why I still call it critical
Start with the storage volume comparison, because it does not hold up. To attach a volume to an instance, you have to be allowed to edit the instance:
// lxd/instances.go
Put: APIEndpointAction{Handler: instancePut, AccessHandler: allowPermission(entity.TypeInstance, auth.EntitlementCanEdit, "name")},
Patch: APIEndpointAction{Handler: instancePatch, AccessHandler: allowPermission(entity.TypeInstance, auth.EntitlementCanEdit, "name")},
A pure viewer cannot write a single byte to a volume. A pure viewer can empty a bucket.
Now look at the whole thing from the admin's side:
-
What it needs: the weakest role LXD offers.
vieweris what you give a dashboard, a monitoring agent, an auditor, a CI job that only reads. - What it gets you: read, write and delete on every bucket in the project, through the admin key LXD created for each of them.
- What it takes: two GET requests. No race, no exploit chain, no luck.
-
What warns you: nothing. The
read-onlykey role does not help, because whoever can see keys sees the admin key too. And none of this was written down anywhere I could find. Not in the bucket how-to, not in the permissions reference.
Lowest privilege in, full data access out, silently, and it has worked like that since buckets shipped. A role called viewer that can delete your backups is going to surprise people, and surprises like that are how data disappears.
Canonical gets to decide whether this is a vulnerability. Whether it is critical for your server is your call. I have made mine.
What I got wrong
Not the severity. Two other things.
Leading with the number. 9.9 versus 8.8 comes down to one checkbox, and a number invites an argument about the number. The sentence nobody can argue with is: a viewer can delete your bucket data. That should have been the first line of the report, not the CVSS vector.
The order of operations. I went code first, proof second, more proof third, intent never. Nobody doubted that it works. The only open question was whether it is supposed to work, and no amount of Ceph answers that. Before reporting, I should have asked whether the behavior looks deliberate:
# How old is it? Old and stable usually means on purpose.
git log --oneline --follow -- lxd/storage_buckets.go | tail -3
# Is there an official command that does exactly my "exploit"?
grep -rn "bucket key show" doc/
# Does anything, anywhere, ever hide the secret?
grep -rn "SecretKey" lxd/ shared/api/
Ten minutes of that and I would have known I was not filing a bug. I was starting an argument about design. That argument belongs in public, where the people running LXD can read it, not in a private advisory where the only possible outcomes are "fixed" and "closed".
If you run LXD with storage buckets
Until the docs say otherwise, treat "can view the bucket" as "has the admin key". To see who that is on your server:
# Which groups exist, and what does each one get?
lxc auth group list
lxc auth group show <group_name>
# Every bucket, with the groups that hold permissions on it
lxc auth permission list entity_type=storage_bucket
# On a project with buckets, each of these means "has the keys":
# viewer, operator, storage_bucket_manager, can_view_storage_buckets
Do not give viewer on a project to monitoring or audit accounts if that project has buckets with data you care about.
As for me, I replied with the volume argument and asked whether a docs patch would be welcome. It is ready, and it says the quiet part out loud:
+ Anyone who can view a storage bucket can also view its keys,
+ including the secret key of each set of credentials.
+ This includes the `admin` key that LXD creates automatically
+ for every new bucket.
After that I will suggest a separate entitlement for key material, so that "can see the bucket" and "can have the keys" stop being the same sentence. Maybe they take it. Maybe they close that one too. I am getting good at being closed.
Moral of the story
- A vulnerability is a broken promise. If the vendor never made the promise, you found a design decision. That does not make it harmless.
- Read the security model before the code, and check intent before you write the report.
- "No CVE" is not the same as "no risk".
- "Read-only" is a suggestion until you have checked what can be read.
I came for a CVE and I am leaving with four lines of documentation and a Ceph cluster I no longer need. The behavior is still there, and I still call it critical. With a bit of luck, it will at least be written down soon.
Top comments (0)