LFCS · Question #388
An unprivileged user issued a command which produced the following log message: avc: denied { getattr } for pid=984 exe=/usr/bin/vim path=/etc/shadow dev=03:01 ino=134343 scontext=hugh:user_r:user_t…
The correct answer is A. User hugh was not running in a security context that permitted reading the file. The SELinux AVC denial message indicates that user 'hugh' (running in user_r:user_t context) was denied the getattr permission on the /etc/shadow file, meaning their current security context does not allow reading its attributes.
Question
Options
- AUser hugh was not running in a security context that permitted reading the file.
- BUser hugh only needs to switch to the object_r role in order to edit /etc/shadow.
- CThe security context for hugh is misconfigured and needs access to read any system file.
- DUser hugh was not running in a security context that permitted writing to the file.
How the community answered
(24 responses)- A92% (22)
- C4% (1)
- D4% (1)
Why each option
The SELinux AVC denial message indicates that user 'hugh' (running in `user_r:user_t` context) was denied the `getattr` permission on the `/etc/shadow` file, meaning their current security context does not allow reading its attributes.
The `avc: denied` message explicitly states `{{ getattr }}`, which is an access vector permission related to getting attributes or, broadly, reading metadata about a file. The `scontext=hugh:user_r:user_t` indicates the security context of the user, and `tcontext=system_u:object_r:shadow_t` is the context of `/etc/shadow`. The denial means the policy forbids the `user_t` domain from performing `getattr` on `shadow_t` files.
The `object_r` is typically a role for objects, not users, and switching to `object_r` is not a standard or correct way for a user to gain access; furthermore, the specific denial is `getattr`, not editing.
While a denial might indicate a policy issue or misconfiguration in a broader sense, stating that the user "needs access to read *any* system file" is too broad and incorrect; SELinux aims to restrict, not grant universal access. The issue is with a specific permission on a specific file.
The log message clearly indicates `{{ getattr }}` as the denied permission, not a write operation. Write operations would typically involve permissions like `write`, `setattr`, or `open` with write flags.
Concept tested: SELinux AVC denial message interpretation
Source: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/sect-security-enhanced_linux-troubleshooting-interpreting_denials.html
Topics
Community Discussion
No community discussion yet for this question.