/path/to/image.ext 657103 #Cat the file
```
File Mode
| Number | Description |
| ------ | --------------------------------------------------------------------------------------------------- |
| **15** | **Reg/Slink-13/Socket-14** |
| **14** | **Directory/Block Bit 13** |
| **13** | **Char Device/Block Bit 14** |
| **12** | **FIFO** |
| 11 | Set UID |
| 10 | Set GID |
| 9 | Sticky Bit (without it, anyone with Write & exec perms on a directory can delete and rename files) |
| 8 | Owner Read |
| 7 | Owner Write |
| 6 | Owner Exec |
| 5 | Group Read |
| 4 | Group Write |
| 3 | Group Exec |
| 2 | Others Read |
| 1 | Others Write |
| 0 | Others Exec |
The bold bits (12, 13, 14, 15) indicate the type of file the file is (a directory, socket...) only one of the options in bold may exit.
Directories
| Offset | Size | Name | Description |
| ------ | ---- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 0x0 | 4 | Inode | |
| 0x4 | 2 | Rec len | Record length |
| 0x6 | 1 | Name len | Name length |
| 0x7 | 1 | File type | 0x00 Unknown
0x01 Regular
0x02 Director
0x03 Char device
0x04 Block device
0x05 FIFO
0x06 Socket
0x07 Sym link
|
| 0x8 | | Name | Name string (up to 255 characters) |
**To increase the performance, Root hash Directory blocks may be used.**
**Extended Attributes**
Can be stored in
* Extra space between inodes (256 - inode size, usually = 100)
* A data block pointed to by file\_acl in inode
Can be used to store anything as a users attribute if the name starts with "user". So data can be hidden this way.
Extended Attributes Entries
| Offset | Size | Name | Description |
| ------ | ---- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 0x0 | 1 | Name len | Length of attribute name |
| 0x1 | 1 | Name index | 0x0 = no prefix
0x1 = user. Prefix
0x2 = system.posix_acl_access
0x3 = system.posix_acl_default
0x4 = trusted.
0x6 = security.
0x7 = system.
0x8 = system.richacl
|
| 0x2 | 2 | Value offs | Offset from first inode entry or start of block |
| 0x4 | 4 | Value blocks | Disk block where value stored or zero for this block |
| 0x8 | 4 | Value size | Length of value |
| 0xC | 4 | Hash | Hash for attribs in block or zero if in inode |
| 0x10 | | Name | Attribute name w/o trailing NULL |
```bash
setfattr -n 'user.secret' -v 'This is a secret' file.txt #Save a secret using extended attributes
getfattr file.txt #Get extended attribute names of a file
getdattr -n 'user.secret' file.txt #Get extended attribute called "user.secret"
```
## Filesystem View
To see the contents of the file system, you can **use the free tool**: [https://www.disk-editor.org/index.html](https://www.disk-editor.org/index.html)\
Or you can mount it in your linux using `mount` command.
[https://piazza.com/class\_profile/get\_resource/il71xfllx3l16f/inz4wsb2m0w2oz#:\~:text=The%20Ext2%20file%20system%20divides,lower%20average%20disk%20seek%20time.](https://piazza.com/class\_profile/get\_resource/il71xfllx3l16f/inz4wsb2m0w2oz#:\~:text=The%20Ext2%20file%20system%20divides,lower%20average%20disk%20seek%20time.)
βοΈ HackTricks Cloud βοΈ -π¦ Twitter π¦ - ποΈ Twitch ποΈ - π₯ Youtube π₯
- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
- **Join the** [**π¬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**π¦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
- **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**.