# Readable /etc/shadow

### Overview

Linux stores user authentication data across two key files:

* `/etc/passwd` – publicly readable user information
* `/etc/shadow` – **password hashes and account metadata**

By design, `/etc/shadow` should only be readable by **root**.\
If a low-privileged user can read this file, they gain access to **password hashes for all local users**, including root.

### Why this Works

This technique works because:

* Password hashes are meant to be **protected from unprivileged users**
* Hashes can be attacked **offline**, without interacting with the system
* If a password is weak or reused, privilege escalation becomes trivial

### Prerequisites

1. Local access as a non root user.
2. `/etc/shadow` has **read permissions** for non-root users.

### Steps

1. Confirm whether `/etc/shadow` is readable by the current user

   ```bash
   ls -l /etc/shadow
   ```
2. Identify hashes for high-value accounts (e.g., root or sudo users).&#x20;

   ```bash
   root:<HASH_HERE>:17298:0:99999:7:::
   ```
3. Extract the hash and try cracking it offline.

   ```bash
   john --wordlist=/usr/share/wordlists/rockyou.txt root_hash.txt
   ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gokulkarthik.gitbook.io/pentesting-checklist/linux/linux-privilege-escalation/weak-file-permissions/readable-etc-shadow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
