]> xenbits.xensource.com Git - xen.git/commit
tools/ocaml/xenstored: do permission checks on xenstore root
authorEdwin Török <edvin.torok@citrix.com>
Tue, 15 Dec 2020 13:42:32 +0000 (14:42 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 15 Dec 2020 13:42:32 +0000 (14:42 +0100)
commite8231b61b22b8836f40b2f86394b52242b36c4c4
tree063b4dd3bef220b6f9851ab5f946fad139ac95a2
parent1d72d9915edff0dd41f601bbb0b1f83c02ff1689
tools/ocaml/xenstored: do permission checks on xenstore root

This was lacking in a disappointing number of places.

The xenstore root node is treated differently from all other nodes, because it
doesn't have a parent, and mutation requires changing the parent.

Unfortunately this lead to open-coding the special case for root into every
single xenstore operation, and out of all the xenstore operations only read
did a permission check when handling the root node.

This means that an unprivileged guest can:

 * xenstore-chmod / to its liking and subsequently write new arbitrary nodes
   there (subject to quota)
 * xenstore-rm -r / deletes almost the entire xenstore tree (xenopsd quickly
   refills some, but you are left with a broken system)
 * DIRECTORY on / lists all children when called through python
   bindings (xenstore-ls stops at /local because it tries to list recursively)
 * get-perms on / works too, but that is just a minor information leak

Add the missing permission checks, but this should really be refactored to do
the root handling and permission checks on the node only once from a single
function, instead of getting it wrong nearly everywhere.

This is XSA-353.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/ocaml/xenstored/store.ml