get_file_by_name does not check owner

Bug #1212205 reported by Gavin Panella
264
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Blake Rouse
1.2
Won't Fix
Critical
Unassigned
1.3
Won't Fix
Critical
Unassigned
1.5
Won't Fix
Undecided
Unassigned
1.7
Won't Fix
Undecided
Unassigned
1.9
Fix Released
Critical
Blake Rouse

Bug Description

maasserver.api.get_file_by_name is used to define a couple of API operations: AnonFilesHandler.get_by_name and FilesHandler.get_by_name. However, it does not verify ownership of the file, thus allowing anyone to download any file. FileHandler.read is an example of what should be done.

get_file_by_key may be similarly vulnerable; filed as bug 1379826.

Tags: api security

CVE References

Changed in maas:
milestone: none → 13.10
Revision history for this message
Raphaël Badin (rvb) wrote :

My first intention was to simply remove the get_by_name() API operation from the anonymous handler. This is what I've done in https://code.launchpad.net/~rvb/maas/fix-get-file-by-name/+merge/187754 and the package I created from it worked fine with juju-core because juju-core uses either authenticated calls or get_file_by_key() to access the files it needs.

Sadly, this is not the case with (py)juju which really needs the anonymous get_by_name() API operation. Note that it needs it to get from the MAAS server files related to charms and which contain a random element (the file names are something like 'mysql-charm-sdfkj56lkjsdflkj4td'). The random element is probably there to mitigate the security risk.

This is rather problematic because the same code has to accommodate both juju-core and (py)juju. We could land my branch above if we choose to abandon pyjuju compatibility.

Revision history for this message
Gavin Panella (allenap) wrote :

If we can't abandon PyJuju there might still be something we can do to reduce the problem. If there's a pattern for these filenames - e.g. ^\w+-charm-\w+$ - then perhaps we can permit anonymous access for just these files. It's still a hole, though a smaller one. We could additionally have a config option to permit this, which defaults to false.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Unfixed for a year, can't be critical.

Revision history for this message
Christian Reis (kiko) wrote :

Unless someone really depends on it, we should kill this and deprecate pyjuju support. Can someone check with Alexis, Mark Ramm and Ante to see if this is the case?

Revision history for this message
Christian Reis (kiko) wrote :

Just wrote to them; let's see what they say.

Revision history for this message
Raphaël Badin (rvb) wrote :

@Kiko: I've testing this in the lab and go juju deploys services all right. Can you please do some more testing on this?

(I'm re-assigning this to you as I'll be travelling tonight and probably unavailable)

Gavin Panella (allenap)
description: updated
Revision history for this message
Raphaël Badin (rvb) wrote :

We decided to wait till after 1.7 is release in order to publish a fix for this bug, for all the versions of MAAS out there at the same time.

Revision history for this message
Christian Reis (kiko) wrote :

This is ready to land, but we'll hold off until the first point release where we can do a security-only change which we backport to trusty and precise.

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

This is CVE-2014-1426

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

What's the status on this issue? Did this get fixed? Does this bug need to remain private?

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

This security bug has been open for over two years now. I plan on making this bug public on 2016-05-01.

Changed in maas:
status: Fix Committed → Fix Released
information type: Private Security → Public Security
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.