Course outline

Linux Security / Basic: identity, resources, and evidence / Lesson 7

Distinguish directory traversal from file access

Investigate a synthetic file-access decision using separate directory and file boundaries.

About 4 min readContent reviewed
On this page

Lesson goals

  • Describe parent directory traversal requirements.
  • Compare effective identity and relevant permissions.
  • Verify allowed and denied synthetic access.

Define a file access question

A file access decision depends on more than the final file’s visible mode bits. In a disposable Linux lab, define a synthetic service user, an unrelated user, a directory and a file owned for the exercise. The service should reach and read its intended file while the unrelated user is denied. Agree that policy before changing anything. Do not use a live service or real sensitive files. Preserve the initial ownership and permission evidence so a later comparison has context.

Separate directory traversal from file access

To reach a file by path, a process must be able to traverse the relevant parent directories as well as perform the requested operation on the file. The first table describes an illustrative policy, not actual command output. A file that appears readable may still be inaccessible if a parent directory denies traversal. Conversely, permissive traversal does not grant every file operation. Treat directory and file decisions separately when explaining an observed denial.

text Synthetic access model
Resource | Intended identity | Expected
lab directory | service user | traversal allowed
private file | unrelated user | denied

The table describes lab expectations and is not an executable command.

Inspect the effective decision

Compare the process’s effective identity and groups with the owner, group, mode and applicable access control list of each relevant object. Other policy layers may impose further restrictions, so do not claim that mode bits alone explain all Linux access. The second table identifies two boundaries to inspect; it is not a command to change them. In the lab, change one authorized setting at a time and record what changed rather than granting broad access to every user.

text Synthetic access model
Boundary | Check
parent directory | traversal permission
file | requested operation permission

The table describes lab expectations and is not an executable command.

Test positive and negative paths

Use fresh synthetic data to test the intended service action and the unrelated user’s denied action. Observe both the returned result and whether a file was created, read or changed, using the lab’s approved safe method. If the legitimate action fails, preserve the exact denial and inspect the responsible boundary before editing another setting. If the unrelated action succeeds, the test has revealed excessive access even though the service task worked. Keep recovery information for the disposable environment.

Record the limits of the result

After a bounded correction, repeat the positive and negative cases and compare the effective identity and relevant directory and file permissions with the approved lab policy. Record the objects and policy layers examined, along with any access control list or mandatory policy not evaluated. One successful read and one denial support those specific cases; they do not establish the permissions of every path, process or production host. Retain the synthetic test as a regression check.

Common errors and fixes

Looking only at the final file mode

Why it happens
A parent directory may deny traversal.
How to fix it
Inspect each relevant path boundary in the lab.
Prevent it next time
Document the complete access path.

Granting broad permissions to remove a denial

Why it happens
The responsible layer was not identified.
How to fix it
Restore the approved scope and diagnose one boundary at a time.
Prevent it next time
Pair allowed and unrelated denied tests.

Assuming mode bits explain every denial

Why it happens
ACL or mandatory policy may also apply.
How to fix it
Review the applicable layers and effective identity.
Prevent it next time
Record which controls were evaluated.

2 practice exercises

1. A file is readable to a user but its parent denies traversal. What should be investigated?

Show worked solution

Inspect traversal on the relevant parent directories as well as file permissions and other policy layers in the isolated lab.

2. The service can read its file but an unrelated user can too. Is the policy verified?

Show worked solution

No. The negative case fails. Review effective permissions and adjust only the responsible authorized boundary.

Key takeaways

  • A path requires appropriate directory traversal and file access.
  • Test intended and unrelated identities in a disposable lab.

Official references