Security analysis of virtio-fs functions #10
dimakuv
started this conversation in
Security analysis
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
DISCLAIMER: THIS DESCRIPTION IS OLD, SOME FUNCTIONS ETC. MAY HAVE CHANGED/WERE ADDED!
General notes
virtio_fs_exec_request()for code.fuse_out_header::uniquefield is not used at all.FUSE_INITSignature:
int virtio_fs_fuse_init(void)7.31. Nothing secret here.7.9(due to compatibility issues).fuse_init_out. So no possibility of attacks.FUSE_LOOKUPSignature:
int virtio_fs_fuse_lookup(const char* filename, uint64_t* out_nodeid)filename-- needs to be seen by VMM, no secret leak.out_nodeid-- opaque number; doesn't affect control flow in any of the callers; used purely as an opaque input to other FUSE ops.FUSE_READLINKSignature:
int virtio_fs_fuse_readlink(uint64_t nodeid, uint64_t size, char* out_buf, uint64_t* out_size)nodeid-- opaque number as reported byvirtio_fs_fuse_lookup(), no secret.size-- size of the buffer that will hold the link path, no secret.out_buf-- buffer in which the link path will be copied into; a bounce buffer is used to not overwrite this buffer contents until the FUSE op finishes successfully. The number of copied bytes is verified to not exceedsize.out_size-- the number of copied bytes; verified to not exceedsize.FUSE_OPENSignature:
int virtio_fs_fuse_open(uint64_t nodeid, uint32_t flags, uint64_t* out_fh)nodeid-- opaque number as reported byvirtio_fs_fuse_lookup(), no secret.flags-- flags to open the file, no secret.out_fh-- opaque identifier (file handle) used by the FUSE server; doesn't affect control flow in any of the callers; used purely as an opaque input to other FUSE ops.FUSE_CREATESignature:
FUSE_CREATEis a sum of three operations: file creation +FUSE_LOOKUP+FUSE_OPEN.dir_nodeid-- opaque number as reported byvirtio_fs_fuse_lookup(), no secret.filename-- base name of the to-be-created file, no secret.flags-- flags to open the file, no secret.mode-- permissions with which to create the file, no secret.out_nodeid-- opaque number; doesn't affect control flow in any of the callers; used purely as an opaque input to other FUSE ops.out_fh-- opaque identifier (file handle) used by the FUSE server; doesn't affect control flow in any of the callers; used purely as an opaque input to other FUSE ops.FUSE_RELEASESignature:
int virtio_fs_fuse_release(uint64_t nodeid, uint64_t fh)This FUSE operation doesn't update any Gramine state, so no possibility of attacks.
FUSE_UNLINKSignature:
int virtio_fs_fuse_unlink(uint64_t dir_nodeid, const char* filename)This FUSE operation doesn't update any Gramine state, so no possibility of attacks.
FUSE_RENAMESignature:
This FUSE operation doesn't update any Gramine state, so no possibility of attacks.
FUSE_READSignature:
nodeid-- opaque number as reported byvirtio_fs_fuse_lookup(), no secret.fh-- opaque identifier (file handle) as reported byvirtio_fs_fuse_open(); no secret.size-- size of the buffer to fill, no secret.offset-- offset in the host file to read from, no secret.out_buf-- buffer in which the file contents are copied into. This buffer is zeroed-out in case of any failures (to not accidentally transfer malicious data into the Gramine TD). The number of copied bytes is verified to not exceedsize.out_size-- the number of copied bytes; verified to not exceedsize.FUSE_WRITESignature:
nodeid-- opaque number as reported byvirtio_fs_fuse_lookup(), no secret.fh-- opaque identifier (file handle) as reported byvirtio_fs_fuse_open(); no secret.buf-- buffer from which the file contents are copied from. Buffer contents are either encrypted (in case of Protected Files) or don't matter (in case of Allowed Files). The number of copied-out bytes is verified to not exceedsize.size-- size of the buffer, no secret.offset-- offset in the host file to write to, no secret.out_size-- the number of copied bytes; verified to not exceedsize.FUSE_FLUSHSignature:
int virtio_fs_fuse_flush(uint64_t nodeid, uint64_t fh)This FUSE operation doesn't update any Gramine state, so no possibility of attacks.
FUSE_GETATTRSignature:
nodeid-- opaque number as reported byvirtio_fs_fuse_lookup(), no secret.fh-- opaque identifier (file handle) as reported byvirtio_fs_fuse_open(); no secret.flags-- alwaysFUSE_GETATTR_FHin current Gramine code. Signifies that the file was opened. No secret.max_size-- maximum size of the file that the caller is ready to accept. This may beUINT64_MAXif the caller is fine with any file size, or some smaller limit so that the caller can e.g. safelymalloc()such size -- for example, reading the manifest limits the manifest file size to 1GB.out_attr-- file attributes. Onlysizeandmodeare used (size can be limited bymax_size, andmodeis limited to regular files and dirs). All other file attributes are unused and are zeroed out for security.FUSE_SETATTRSignature:
int virtio_fs_fuse_setattr(uint64_t nodeid, const struct fuse_setattr_in* setattr)nodeid-- opaque number as reported byvirtio_fs_fuse_lookup(), no secret.setattr-- file attributes to set. Currently only size (FATTR_SIZE) and mode/permissions (FATTR_MODE) are set by Gramine.This FUSE operation doesn't update any Gramine state, so no possibility of attacks.
FUSE_OPENDIRSignature:
int virtio_fs_fuse_opendir(uint64_t nodeid, uint32_t flags, uint64_t* out_fh)nodeid-- opaque number as reported byvirtio_fs_fuse_lookup(), no secret.flags-- flags to open the dir, no secret.out_fh-- opaque identifier (dir handle) used by the FUSE server; doesn't affect control flow in any of the callers; used purely as an opaque input to other FUSE ops.This function has exactly the same properties as
FUSE_OPEN.FUSE_MKDIRSignature:
dir_nodeid-- opaque number as reported byvirtio_fs_fuse_lookup(), no secret.dirname-- base name of the to-be-created dir, no secret.mode-- permissions with which to create the dir, no secret.out_nodeid-- opaque number; doesn't affect control flow in any of the callers; used purely as an opaque input to other FUSE ops.This function is very similar in its properties to
FUSE_CREATE.FUSE_RELEASEDIRSignature:
int virtio_fs_fuse_releasedir(uint64_t nodeid, uint64_t fh)This FUSE operation doesn't update any Gramine state, so no possibility of attacks. This function has exactly the same properties as
FUSE_RELEASE.FUSE_RMDIRSignature:
int virtio_fs_fuse_rmdir(uint64_t dir_nodeid, const char* dirname)This FUSE operation doesn't update any Gramine state, so no possibility of attacks. This function has exactly the same properties as
FUSE_UNLINK.FUSE_READDIRSignature:
nodeid-- opaque number as reported byvirtio_fs_fuse_lookup(), no secret.fh-- opaque identifier (dir handle) as reported byvirtio_fs_fuse_open(); no secret.size-- size of the buffer to fill, no secret.offset-- offset in the host dir to read from, no secret.out_dirents-- buffer in which the dir contents (directory entries) are copied into. This buffer is zeroed-out in case of any failures (to not accidentally transfer malicious data into the Gramine TD). The number of copied bytes is verified to not exceedsize.out_size-- the number of copied bytes; verified to not exceedsize.This FUSE operation is very similar to
FUSE_READ.Beta Was this translation helpful? Give feedback.
All reactions