Normal user can replace active image data if show_multiple_locations has been set to true

Bug #1549483 reported by Mike Fedosin
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Confirmed
High
Unassigned
OpenStack Security Advisory
Opinion
Undecided
Unassigned
OpenStack Security Notes
Fix Released
Undecided
Robert Clark

Bug Description

Some time ago there was a security bug https://bugs.launchpad.net/glance/+bug/1525915 and a patch was proposed and merged in Glance repo. Unfortunately it partially fixed the problem and the issue with immutability still exists.

Bug description:
User (non admin) can change image data by updating location for image when "show_multiple_locations" config parameter has been set to true. This breaks the immutability of images in Glance and allows malicious user to replace data after image activation.

mfedosin@wdev:~$ glance image-create --name good --disk-format qcow2 --container-format bare --visibility public
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | None |
| container_format | bare |
| created_at | 2015-11-10T18:41:53Z |
| disk_format | qcow2 |
| id | 2a745d21-66b7-43e0-90b5-ebe62232f7d6 |
| locations | [] |
| min_disk | 0 |
| min_ram | 0 |
| name | good |
| owner | f3b42d4b90d840b8806e46fb4a7edca3 |
| protected | False |
| size | None |
| status | queued |
| tags | [] |
| updated_at | 2015-11-10T18:41:53Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------+
mfedosin@wdev:~$ glance location-add 2a745d21-66b7-43e0-90b5-ebe62232f7d6 --url 'https://dl.dropboxusercontent.com/u/13626875/good.txt'
+------------------+----------------------------------------------------------------------------------+
| Property | Value |
+------------------+----------------------------------------------------------------------------------+
| checksum | None |
| container_format | bare |
| created_at | 2015-11-10T18:41:53Z |
| disk_format | qcow2 |
| file | /v2/images/2a745d21-66b7-43e0-90b5-ebe62232f7d6/file |
| id | 2a745d21-66b7-43e0-90b5-ebe62232f7d6 |
| locations | [{"url": "https://dl.dropboxusercontent.com/u/13626875/good.txt", "metadata": |
| | {}}] |
| min_disk | 0 |
| min_ram | 0 |
| name | good |
| owner | f3b42d4b90d840b8806e46fb4a7edca3 |
| protected | False |
| schema | /v2/schemas/image |
| size | 43 |
| status | active |
| tags | [] |
| updated_at | 2015-11-10T18:42:21Z |
| virtual_size | None |
| visibility | public |
+------------------+----------------------------------------------------------------------------------+
mfedosin@wdev:~$ glance image-download 2a745d21-66b7-43e0-90b5-ebe62232f7d6 --file ooo
mfedosin@wdev:~$ cat ooo
I'm really good image.
mfedosin@wdev:~$ glance location-add 2a745d21-66b7-43e0-90b5-ebe62232f7d6 --url 'https://dl.dropboxusercontent.com/u/13626875/bad.txt'
+------------------+----------------------------------------------------------------------------------+
| Property | Value |
+------------------+----------------------------------------------------------------------------------+
| checksum | None |
| container_format | bare |
| created_at | 2015-11-10T18:41:53Z |
| disk_format | qcow2 |
| file | /v2/images/2a745d21-66b7-43e0-90b5-ebe62232f7d6/file |
| id | 2a745d21-66b7-43e0-90b5-ebe62232f7d6 |
| locations | [{"url": "https://dl.dropboxusercontent.com/u/13626875/good.txt", "metadata": |
| | {}}, {"url": "https://dl.dropboxusercontent.com/u/13626875/bad.txt", "metadata": |
| | {}}] |
| min_disk | 0 |
| min_ram | 0 |
| name | good |
| owner | f3b42d4b90d840b8806e46fb4a7edca3 |
| protected | False |
| schema | /v2/schemas/image |
| size | 43 |
| status | active |
| tags | [] |
| updated_at | 2015-11-10T18:42:29Z |
| virtual_size | None |
| visibility | public |
+------------------+----------------------------------------------------------------------------------+
mfedosin@wdev:~$ glance location-delete 2a745d21-66b7-43e0-90b5-ebe62232f7d6 --url 'https://dl.dropboxusercontent.com/u/13626875/good.txt'
mfedosin@wdev:~$ glance image-download 2a745d21-66b7-43e0-90b5-ebe62232f7d6 --file ooo
mfedosin@wdev:~$ cat ooo
All your base are belong to us! Muahahaha!

Tags: security
Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

Since this report concerns a possible security risk, an incomplete security advisory task has been added while the core security reviewers for the affected project or projects confirm the bug and discuss the scope of any vulnerability along with potential solutions.

Changed in ossa:
status: New → Incomplete
description: updated
Revision history for this message
Flavio Percoco (flaper87) wrote :

I was *just* chatting with flwang about this issue. I'll add Fei Long as he's also working on this.

Thanks for the report, Mike.

Revision history for this message
Feilong Wang (flwang) wrote :

Firstly, for the cloud operation perspective, the image publish policy should be enabled to avoid non-admin user publish image. But we still can't avoid user swap image data for his personal image. That's the thing we should discuss. Please let me know if I missed something. Thanks.

Revision history for this message
Jeremy Stanley (fungi) wrote :

For clarity, since I'm regrettably unfamiliar with Glance's internals, how does it actually ensure that the data at every listed location for an image is bit-for-bit identical? Does it retrieve them all, calculate checksums and try to match them? Otherwise, it seems like the idea of multiple locations for a single image is inherently incompatible with the idea of image immutability.

Revision history for this message
Feilong Wang (flwang) wrote :

That's a good question. And unfortunately, Glance doesn't comparing the checksums when adding a new location.

Revision history for this message
Jeremy Stanley (fungi) wrote :

Given that, I'm inclined to chalk that up to incomplete design and something that's not going to get properly solved by some short, backward-compatible stable backport patches under embargo. If Glance has no actual ability to guarantee that all locations for an image contain identical data then there is no image immutability guarantee while using multiple locations anyway.

Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

Agreed with the B2 class (according to https://security.openstack.org/vmt-process.html#incident-report-taxonomy ).
If no one objects, let's remove privacy setting of this bug report by the end of the week.

Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

I've subscribed OSSG-coresec to discuss an eventual document about Glance image locations.

Revision history for this message
Travis McPeak (travis-mcpeak) wrote :

I agree with Jeremy - this seems like an incomplete design. If an image has multiple locations the hash for the resource at those locations should be required to match.

I'll add a note task for this.

Revision history for this message
Robert Clark (robert-clark) wrote :

Agree with an OSSN as there's no clear path to a fix.

Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

Should we keep those glance image location related bug reports private and coordinate their disclosure with the OSSN ?

Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

Yes, I think that sounds like a fine approach.

The glance team is planning to gather at some point during the summit to further discuss general issues with image locations. Until then let's keep these private.

Revision history for this message
Travis McPeak (travis-mcpeak) wrote :

+1, we'll follow our "private" note process.

Revision history for this message
Robert Clark (robert-clark) wrote :
Revision history for this message
Robert Clark (robert-clark) wrote :

Thoughts on this?

Users of Glance may be able to replace active image data
---

### Summary ###
When Glance has been configured with the "show_multiple_locations"
parameter enabled it is possible for a non-admin user to replace active
image data.

### Affected Services / Software ###
Glance, Havana, Icehouse, Juno, Kilo, Liberty, Mitaka, Newton

### Discussion ###
Glance has a multiple location feature that allows a single image to be
stored in multiple places. This is intended to offer an extra degree of
resilience by improving the availability of Glance images.

This feature involves a user pushing a new location for an image via the
Glance API. However, this process does not involve a checksum of the
existing or newly created image locations - allowing a malicious user to
push a different or altered image as an alternative location for an
existing one.

An attacker could add a malicious image to a location for an existing
one potentially leading to other users of the cloud unknowingly using
the malicious image.

### Recommended Actions ###
In production clouds the image publish policy should be enabled to
prevent non-admin users publishing images that can be used by other
users of the cloud. This does not mitigate the issue completely but it
does constrain the issue to an individual user. It is still possible
that a workload running under one user could be compromised and in turn
abuse the multiple location feature to compromise other workloads
running under that same user.

The safest course of action is to disable support for multiple locations
by editing glance-api.conf:

---- begin glance-api.conf snippet ----
  [DEFAULT]
  show_multiple_locations = False
---- end glance-api.conf snippet ----

### Contacts / References ###
This OSSN : https://wiki.openstack.org/wiki/OSSN/OSSN-0065
Original LaunchPad Bug : https://bugs.launchpad.net/glance/+bug/1549483
OpenStack Security ML : <email address hidden>
OpenStack Security Group : https://launchpad.net/~openstack-ossg
Multiple Image Location BP : https://blueprints.launchpad.net/glance/+spec/multiple-image-locations

Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

Hi Robert,

Thank you for the write up. I've a few suggestions, let me know your thoughts:

#1

### Summary ###
When Glance API has been configured with the "show_multiple_locations"
parameter enabled along with default policies, it is possible for a non-admin user to replace active
image data by manipulating the location by updating Image record.

#2
### Discussion ###
Glance has a multiple location feature that allows a single image to be
stored in multiple places. This is intended to offer an extra degree of
resilience by improving the availability of Glance images as well as to help operators improve performance and reduce errors during inbound and outbound image data streaming.

This feature can allow a user pushing a new location for an image via the
Glance API. However, this process does not involve a checksum of the
existing or newly created image locations - allowing a malicious user to
push a different or altered image as an alternative location for an
existing one.

An attacker could add a malicious data to a non-public image where they are authorized to a location for an existing
image, potentially leading to other users of the cloud unknowingly using
the malicious image, given that image is shared with other users.

#3
### Recommended Actions ###
In production clouds the image publish policy should be enabled to
prevent non-admin users publishing images that can be used by other
users of the cloud. This does not mitigate the issue completely but it
does constrain the issue to an individual user. It is still possible
that a workload running under one user could be compromised and in turn
abuse the multiple location feature to compromise other workloads
running under that same user or an innocent error for specifying incorrect location may result into potential data loss for that cloud without consistency of checksum.

The safest course of action is to disable support for multiple locations
by editing glance-api.conf:

---- begin glance-api.conf snippet ----
  [DEFAULT]
  show_multiple_locations = False
---- end glance-api.conf snippet ----

---

Thoughts?

Changed in ossn:
assignee: nobody → hyakuhei (hyakuhei)
Revision history for this message
Robert Clark (robert-clark) wrote :

OSSN is basically ready (updated version in gitlab). Next steps please?

Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

@Nikhil

"the image publish policy should be enabled to prevent non-admin users publishing images"

There is no 'image publish' policy. Should 'image publish policy' read 'publicize_image policy' or something else?

When you say 'publishing images' do you mean 1. marking images as public or 2. both marking images as public and sharing images or 3. just uploading images? Thanks.

Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

@Robert, the next steps are:
* approve the OSSN
* remove privacy settings of location's related bug
* publish the OSSN
* close OSSA task and points to the Security Note

The proposed note sounds good to me.

Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

Can I '-1' this?

It's not possible to follow the recommended action in the proposed note -- it refers to a policy that does not exist.

Also, standard member to member image sharing has not been considered/addressed, so the proposal only partially addresses the issue.

Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

Stuart, I meant that we first need to approve the OSSN before moving on (in order to coordinate the disclosure with the security note publication).

Well if the first paragraph of the recommended action doesn't work, indeed it needs to be fixed first.

Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

Let's wait on the further action before we've come to consensus on what needs to be done.

Good catch Stuart. Thanks for stopping further action on time!

I guess, I missed updating that information in the description!

Yes, "publishing images" is generic enough term to be confused of the scope of the solution (recommended actions).

We should break this down a bit:

1. Operator defined Public images
If cloud operator disallows image sharing and publicizing images, then they need to worry about only images that are defined by admins. There are no actions needed in this case, the public images belonging to the admins are safe.

2. Publishing own images
This is case when sharing is not allowed and cloud is allowing users to publicize their own images; ie. when publicize_image is not restricted to cloud admins. There are no actions needed in this case, the public images belonging to the owners and admins are safe.

3. Shared Images
This is the most unrestricted deployment scenario, image can be potentially shared with any other user of the cloud without the notice of admins and the owner of the image.

recommended actions should be:
a) "set_image_location" and "delete_image_location" should be restricted to cloud admins and owner & project admin

For the #3 uploading images:

I think we can only communicate that users will making their own images redundant if trying to manipulate image data on active images when this config is enabled. Cloud operators should communicate the users of this issues (possibly in a FAQ section) when they decided to deploy this feature.

The policy "publicize_image" shouldn't have any effect on this bug directly (until what's been figured).

---
Error cases:

Unrestricted CR&D on image location

create: as mentioned in the bug description, users may be able to create a incorrect image behind the scene without the knowledge of the owner (if that image is shared with them and set_image_location policy is allowed) or the owner may create an incorrect one inadvertently.

read: it's safe from this bug's perspective

delete: This has the potential of data loss for the user in case they choose to delete their image location inadvertently or if the shared tenant deletes it without knowledge of the user.
---

Thoughts?

Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

Based on above comment and other related issue (bug 1555590 and bug 1546507), I'd like to handle image-location issues as class B2 type of bug according to VMT taxonomy ( http://security.openstack.org/vmt-process.html#incident-report-taxonomy ).

I'm switching the OSSA task status to opinion until a Security Note (OSSN) is defined.
However if a backportable fix can be implemented, then we can revert that decision and issue an advisory.

Changed in ossa:
status: Incomplete → Opinion
Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

(This is limited to enabling the non-default option so, marked as High and not Critical)

I'm adding Nova coresec team to the subscribers' list to help tie the ramifications of this bug with the ongoing Glance v2 work.

Changed in glance:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

For the reason why nova-core sec has been added to this bug, please follow the conversation from comment #46 onward here https://bugs.launchpad.net/glance/+bug/1546507 .

Changed in ossn:
assignee: Robert Clark (robert-clark) → Travis McPeak (travis-mcpeak)
Changed in ossn:
assignee: Travis McPeak (travis-mcpeak) → Robert Clark (robert-clark)
Revision history for this message
Travis McPeak (travis-mcpeak) wrote :

OK this seems stalled. What's required to advance Rob's OSSN draft and get this published?

Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

It seems like the proposed OSSN references an incorrect policy, instead it should mention the "set_image_location" and "delete_image_location" as explained in comment #22

Revision history for this message
Luke Hinds (lhinds) wrote :

Rob, how are you for making the amendment in comment #22, looks like this will be close to complete then.

Revision history for this message
Robert Clark (robert-clark) wrote :

Been a while since I looked at this, not sure if it needs more tweaking.

Users of Glance may be able to replace active image data
---
### Summary ###
When Glance has been configured with the "show_multiple_locations"
parameter enabled it is possible for a non-admin user to replace active
image data.

### Affected Services / Software ###
Glance, Havana, Icehouse, Juno, Kilo, Liberty, Mitaka, Newton

### Discussion ###
Glance has a multiple location feature that allows a single image to be
stored in multiple places. This is intended to offer an extra degree of
resilience by improving the availability of Glance images.
This feature involves a user pushing a new location for an image via the
Glance API. However, this process does not involve a checksum of the
existing or newly created image locations - allowing a malicious user to
push a different or altered image as an alternative location for an
existing one.
An attacker could add a malicious image to a location for an existing
one potentially leading to other users of the cloud unknowingly using
the malicious image.

### Recommended Actions ###
In production clouds the image publish policy should be enabled to avoid
non-admin users publishing images that can be used by other users of the
cloud. This does not mitigate the issue completely but it does
constrain the issue an individual user.

Cloud operators should updating their Glance configuration such that “set_image_location” and “delete_image_location” are restricted to cloud admins and owner & project admin.

### Contacts / References ###
This OSSN : <link to OSSN on wiki>
Original LaunchPad Bug : <link to launchpad bug for affected project/service>
OpenStack Security ML : <email address hidden>
OpenStack Security Group : https://launchpad.net/~openstack-ossg
Multiple Image Location BP : https://blueprints.launchpad.net/glance/+spec/multiple-image-locations
CVE: <CVE number if one was filed>

Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

A few typo (I think):
s/multiple location/multiple locations/
s/constrain the issue an/constrain the issue to an/
s/should updating/should update/

glance-coresec, please review the last note (comment #29)

Revision history for this message
Luke Hinds (lhinds) wrote :

glance-coresec, please confirm if you can this reads ok for you, and then I will send out the note with the above replacements.

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

Just want to acknowledge that we are looking this over, hopefully will get back to you by end of the day.

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

I took the liberty of rewriting the note to be more clear about the extent of the attack (i.e., the user cannot manipulate the checksum, just the data) and to be more clear about how images can be shared out in Glance and what policies govern this. But I'm not a security guy, so Tristan and Luke may need to rewrite. Also, I will grab Nikhil from Glance coresec to read over for accuracy.

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :
Download full text (5.1 KiB)

Users of Glance may be able to replace active image data
---
### Summary ###
When Glance has been configured with the "show_multiple_locations"
option enabled it is possible for a non-admin user to replace active
image data.

### Affected Services / Software ###
Glance, Havana, Icehouse, Juno, Kilo, Liberty, Mitaka, Newton, Ocata

### Discussion ###

As a convenience to operators, Glance has a multiple location feature,
disabled by default, that allows a single image to be stored in multiple
places. This is intended to offer an extra degree of resilience by
improving the availability of Glance images. This feature involves a
user setting a new entry in an image's 'locations' list, not visible to
users by default, via the Glance API. However, this process does not
involve taking a checksum of the data in a newly created image location,
and hence does not involve comparing the 'checksum' field of the image
(which is always visible to users) with the checksum of any added
locations. This design opens the possibility that a malicious user
could create an image in Glance, set an additional location on that
image pointing to an altered image, then delete the original location,
so that consumers of the original image would unwittingly be using the
malicious image. Note, however, that this attack vector cannot change
the original image's checksum, and it is limited to images that are
owned by the attacker.

### Recommended Actions ###

The reach of this attack depends upon how broadly usage of the original
image is spread among consumers who do not checksum images before they
are consumed. Glance enables three ways for an image to be made
available to other users:

1 Making an image "public". This makes an image available to all users
  of a cloud. The ability to do this is governed by the
  'publicize_image' policy, which is restricted to the admin role by
  default since the Juno release.

2 Making an image "community". *This feature is only available since
  Otaca.* This makes an image available to all users of a cloud, but
  unlike a "public" image, it does not appear in the default image-list
  response of any user (other than the owner). It is governed by the
  'communitize_image' policy, which is unrestricted by default.

3 Making an image "shared". Glance allows project-to-project image
  sharing, in which a user in project A shares an image with project B
  by making project B a *member* of the image. The ability to do this
  is governed by the 'add_member' policy, which is unrestricted by
  default.

  * Project-to-project sharing is the default, based on the
    'owner_is_tenant' configuration setting in Glance. In a cloud
    configured so that 'owner_is_tenant' is false, image sharing is
    user-to-user. This is a cloud-wide configuration, users may not
    determine whether sharing is project-to-project or owner-to-owner.

Note that what has been discussed so far is independent of the specific
vulnerablity discussed in this notice. We encourage cloud operators to
review their current settings for the policies mentioned above. In
particular, we recommend that the 'publicize_image' policy be restricted
to admins (as it has...

Read more...

Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

Really nice note Brian. Pretty elaborate and explains almost all details.

A couple of points to consider in this note:

1. Summary

### Summary ###
When Glance has been configured with the "show_multiple_locations" option enabled with default policy for set and delete locations, it is possible for a non-admin user having write access to the image metadata to replace active image data.

2. Public & Community images

These images do not grant write access to the non-owner users of the cloud. Hence, setting an incorrect or malicious locations or manipulations to the image location is not allowed, thus keeping the image location intact and safe for the user.

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

I think Nikhil's change (1) to the summary is good.

Unless I'm misreading it, (2) is a little misleading, though I'm having trouble explaining exactly what I don't like about it. I think the key point is that arbitrary normal users can't manipulate locations on images that they don't own, even if set_location is enabled for everybody and show_multiple_locations is true. But the attack vector as I see it is that the *owner* is doing a bait-and-switch on the image data, and then hoping that some suckers use the image without checking the checksum. So maybe your point is that we shouldn't get too hysterical about this as long as the deployer is smart about who has publicize_image permissions, and end-users keep in mind that you never know what's going to be on a community or shared image, even if the owner *hasn't* done a bait-and-switch (that is, someone could just make a malicious 'community' image that checksums fine, but contains malware).

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

Was looking this over again. Should s/consumed/used/ in the first sentence in the "Recommended Actions" section. (Maybe kind of pedantic, but you can't really checksum the image before you consume it from Glance ... you need to consume it first, then checksum before you use it.)

Revision history for this message
Luke Hinds (lhinds) wrote :

Hi Brian,

If the change is made in the first sentence for "Recommended Actions", does the note look ready to go for you now?

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

@Luke: I think so, if you also use Nikhil's rewrite of the "Summary".

I'll ping him for one more lookover, but I think his other concern is already captured by the last sentence currently in the "Discussion" section. But let me ask this way: is it obvious to you, after reading this, that the attack is limited to images that an attacker owns (or pwns by stealing the owner's credentials)? If so, then I think this is ready to go.

Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

So, my emphasis on the points:

1. public images do not come under this attack vector as non-admin user doesn't have rights to manipulate the image location unless someone has enabled publicize_image policy. (As a separate discussion we should consider deprecating and then removing this policy as we have community images now, will save it for later)

2. community images do come, in the case where a user shares an image and intentionally or unintentionally tries to change the image data but the checksum doesn't match. Consumers of the image are affected as the checksum doesn't match and all further references to the image (nova, snapshots, clones, etc) are affected.

3. shared images do come under this umbrella with the policy permissions requires for set & delete location

Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

I stand corrected on the point # 3 where the right answer is shared images "do not" come under this umbrella:

https://github.com/openstack/glance/blob/b55dd079e02a9c78b82d7e341d3cc51e6cbadab1/glance/db/sqlalchemy/api.py#L280-L291

So the case for community and shared images is same (i.e point #2 & #3 can be combined)

Overall, I think we can go with what we have plus the changes Brian suggested 36, 37 and 39.

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

Luke, I think we're good to go. Please see my question in #39, though. The title of this note is a bit scary, I want to make sure that it's clear that you could replace your *own* active image data by this method, not the data of arbitrary images.

Revision history for this message
Luke Hinds (lhinds) wrote :
Download full text (5.4 KiB)

Here is a round up with the edits:

My feedback is that this makes sense to myself. What I may need is some help with how to toggle the various values, well I could like figure this out, but may need to ping one of you for clarification.

Users of Glance may be able to replace active image data
---
### Summary ###
When Glance has been configured with the "show_multiple_locations" option
enabled with default policy for set and delete locations, it is possible for a
non-admin user having write access to the image metadata to replace active
image data.

### Affected Services / Software ###
Glance, Havana, Icehouse, Juno, Kilo, Liberty, Mitaka, Newton, Ocata

### Discussion ###

As a convenience to operators, Glance has a multiple location feature,
disabled by default, that allows a single image to be stored in multiple
places. This is intended to offer an extra degree of resilience by
improving the availability of Glance images. This feature involves a
user setting a new entry in an image's 'locations' list, not visible to
users by default, via the Glance API. However, this process does not
involve taking a checksum of the data in a newly created image location,
and hence does not involve comparing the 'checksum' field of the image
(which is always visible to users) with the checksum of any added
locations. This design opens the possibility that a malicious user
could create an image in Glance, set an additional location on that
image pointing to an altered image, then delete the original location,
so that consumers of the original image would unwittingly be using the
malicious image. Note, however, that this attack vector cannot change
the original image's checksum, and it is limited to images that are
owned by the attacker.

### Recommended Actions ###

The reach of this attack depends upon how broadly usage of the original
image is spread among consumers who do not checksum images before they
are used. Glance enables three ways for an image to be made
available to other users:

1 Making an image "public". This makes an image available to all users
  of a cloud. The ability to do this is governed by the
  'publicize_image' policy, which is restricted to the admin role by
  default since the Juno release.

2 Making an image "community". *This feature is only available since
  Otaca.* This makes an image available to all users of a cloud, but
  unlike a "public" image, it does not appear in the default image-list
  response of any user (other than the owner). It is governed by the
  'communitize_image' policy, which is unrestricted by default.

3 Making an image "shared". Glance allows project-to-project image
  sharing, in which a user in project A shares an image with project B
  by making project B a *member* of the image. The ability to do this
  is governed by the 'add_member' policy, which is unrestricted by
  default.

  * Project-to-project sharing is the default, based on the
    'owner_is_tenant' configuration setting in Glance. In a cloud
    configured so that 'owner_is_tenant' is false, image sharing is
    user-to-user. This is a cloud-wide configuration, users may not
    determine whether sharing is project-to-project or owner-to...

Read more...

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

Luke, LGTM. Only thing I noticed is that in "Recommended Actions" item 2, 'Otaca' should be 'Ocata' (and actually, it's my error, not yours!).

As far as "toggling" the options goes, if show_multiple_locations is False, then this attack vector is nullified. If show_multiple_locations is True, then the operator needs to use the three "location" policy targets to minimize the attack surface described in the note. But exactly how to set these for a particular cloud, we can't say, it's too variable.

Revision history for this message
Luke Hinds (lhinds) wrote :

Great, I will send out..

Revision history for this message
Luke Hinds (lhinds) wrote :

Update that this will go out to public lists tomorrow

Luke Hinds (lhinds)
description: updated
Changed in ossn:
status: New → Fix Released
information type: Private Security → Public
Jeremy Stanley (fungi)
tags: added: security
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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