21 KiB
âïž HackTricks Cloud âïž -ðŠ Twitter ðŠ - ðïž Twitch ðïž - ð¥ Youtube ð¥
-
ãµã€ããŒã»ãã¥ãªãã£äŒæ¥ã§åããŠããŸããïŒ HackTricksã§äŒç€Ÿã宣äŒãããã§ããïŒãŸãã¯ãææ°ããŒãžã§ã³ã®PEASSã«ã¢ã¯ã»ã¹ããããHackTricksãPDFã§ããŠã³ããŒããããã§ããïŒSUBSCRIPTION PLANSããã§ãã¯ããŠãã ããïŒ
-
The PEASS FamilyãèŠã€ããŠãã ãããç¬å çãªNFTã®ã³ã¬ã¯ã·ã§ã³ã§ãã
-
å ¬åŒã®PEASSïŒHackTricksã®ã°ããºãæã«å ¥ããŸãããã
-
ð¬ Discordã°ã«ãŒããŸãã¯telegramã°ã«ãŒãã«åå ããããTwitterã§ãã©ããŒããŠãã ããðŠ@carlospolopmã
-
ãããã³ã°ã®ããªãã¯ãå ±æããã«ã¯ãhacktricksãªããžããªãšhacktricks-cloudãªããžããªã«PRãæåºããŠãã ããã
Ext - æ¡åŒµãã¡ã€ã«ã·ã¹ãã
Ext2ã¯ããžã£ãŒããªã³ã°ãããŠããªãããŒãã£ã·ã§ã³ïŒããŸãå€æŽãããªãããŒãã£ã·ã§ã³ïŒã®æãäžè¬çãªãã¡ã€ã«ã·ã¹ãã ã§ããããŒãããŒãã£ã·ã§ã³ãªã©ã«äœ¿çšãããŸããExt3/4ã¯ãžã£ãŒããªã³ã°ãããéåžžã¯ãã®ä»ã®ããŒãã£ã·ã§ã³ã«äœ¿çšãããŸãã
ãã¡ã€ã«ã·ã¹ãã ã®ãã¹ãŠã®ãããã¯ã°ã«ãŒãã¯åããµã€ãºã§é æ¬¡æ ŒçŽãããŸããããã«ãããã«ãŒãã«ã¯ãããã¯ã°ã«ãŒãã®ãã£ã¹ã¯äžã®äœçœ®ãæŽæ°ã€ã³ããã¯ã¹ããç°¡åã«å°åºã§ããŸãã
åãããã¯ã°ã«ãŒãã«ã¯ã次ã®æ å ±ãå«ãŸããŠããŸãã
- ãã¡ã€ã«ã·ã¹ãã ã®ã¹ãŒããŒãããã¯ã®ã³ããŒ
- ãããã¯ã°ã«ãŒããã£ã¹ã¯ãªãã¿ã®ã³ããŒ
- ããŒã¿ãããã¯ããããããïŒã°ã«ãŒãå ã®ç©ºããããã¯ãèå¥ããããã«äœ¿çšãããŸã
- inodeããããããïŒã°ã«ãŒãå ã®ç©ºãinodeãèå¥ããããã«äœ¿çšãããŸã
- inodeããŒãã«ïŒé£ç¶ãããããã¯ã®ã·ãªãŒãºã§æ§æãããåãããã¯ã«ã¯äºåå®çŸ©ãããå³1ã®Ext2 inodeçªå·ã®inodeãå«ãŸããŸãããã¹ãŠã®inodeã®ãµã€ãºã¯åãã§ãïŒ128ãã€ãã§ãã1,024ãã€ãã®ãããã¯ã«ã¯8ã€ã®inodeãå«ãŸãã4,096ãã€ãã®ãããã¯ã«ã¯32ã®inodeãå«ãŸããŸããExt2ã§ã¯ãinodeçªå·ãšå¯Ÿå¿ãããããã¯çªå·ã®ãããã³ã°ããã£ã¹ã¯äžã«ä¿åããå¿ èŠã¯ãããŸããããªããªããåŸè ã®å€ã¯ãããã¯ã°ã«ãŒãçªå·ãšinodeããŒãã«å ã®çžå¯Ÿäœçœ®ããå°åºã§ããããã§ããããšãã°ãåãããã¯ã°ã«ãŒãã«4,096ã®inodeãå«ãŸããinode 13,021ã®ãã£ã¹ã¯äžã®ã¢ãã¬ã¹ãç¥ãããå Žåããã®inodeã¯3çªç®ã®ãããã¯ã°ã«ãŒãã«å±ããŠããããã®ãã£ã¹ã¯ã¢ãã¬ã¹ã¯å¯Ÿå¿ããinodeããŒãã«ã®733çªç®ã®ãšã³ããªã«æ ŒçŽãããŠããŸããinodeçªå·ã¯ãExt2ã®ã«ãŒãã³ããã£ã¹ã¯äžã®é©åãªinodeãã£ã¹ã¯ãªãã¿ãè¿ éã«ååŸããããã«äœ¿çšããããŒã§ããããšãããããŸãã
- ãã¡ã€ã«ãå«ãããŒã¿ãããã¯ãæå³ã®ãªãæ å ±ãå«ãŸãªããããã¯ã¯ã空ããšèšãããŸãã
Extã®ãªãã·ã§ã³æ©èœ
æ©èœã¯ããŒã¿ã®é çœ®å Žæã«åœ±é¿ãäžããinodeå ã®ããŒã¿ã®æ ŒçŽæ¹æ³ããããã€ãã®æ©èœã¯è¿œå ã®ã¡ã¿ããŒã¿ãæäŸããå ŽåããããŸãããããã£ãŠãExtã§ã¯æ©èœãéèŠã§ãã
Extã«ã¯ãOSããµããŒããããã©ããã«ãã£ãŠããªãã·ã§ã³ã®æ©èœããããŸãã3ã€ã®å¯èœæ§ããããŸãã
- äºææ§ãã
- äºææ§ãªã
- èªã¿åãå°çšã®äºææ§ããïŒããŠã³ãã¯ã§ããŸãããæžã蟌ã¿ã¯ã§ããŸãã
äºææ§ã®ãªãæ©èœãããå ŽåãOSã¯ããŒã¿ã«ã¢ã¯ã»ã¹ããæ¹æ³ãç¥ããªãããããã¡ã€ã«ã·ã¹ãã ãããŠã³ãã§ããŸããã
{% hint style="info" %} çãããæ»æè ã¯ãéæšæºã®æ¡åŒµæ©èœãæã£ãŠããå¯èœæ§ããããŸã {% endhint %}
ã¹ãŒããŒãããã¯ãèªã¿åãä»»æã®ãŠãŒãã£ãªãã£ã¯ãExtãã¡ã€ã«ã·ã¹ãã ã®æ©èœã瀺ãããšãã§ããŸãããfile -sL /dev/sd*
ã䜿çšããããšãã§ããŸãã
ã¹ãŒããŒãããã¯
ã¹ãŒããŒãããã¯ã¯ãæåã®1024ãã€ãããå§ãŸããåã°ã«ãŒãã®æåã®ãããã¯ã«ç¹°ãè¿ããã次ã®æ å ±ãå«ãã§ããŸãã
- ãããã¯ãµã€ãº
- ç·ãããã¯æ°
- ãããã¯ã°ã«ãŒãããšã®ãããã¯æ°
- æåã®ãããã¯ã°ã«ãŒãã®åã«äºçŽããããããã¯æ°
- ç·inodeæ°
- ãããã¯ã°ã«ãŒãããšã®inodeæ°
- ããªã¥ãŒã å
- æçµæžã蟌ã¿æå»
- æçµããŠã³ãæå»
- ãã¡ã€ã«ã·ã¹ãã ãæåŸã«ããŠã³ããããå Žæ
- ãã¡ã€ã«ã·ã¹ãã ã®ã¹ããŒã¿ã¹ïŒã¯ãªãŒã³ïŒïŒ
Extãã¡ã€ã«ã·ã¹ãã ãã¡ã€ã«ãããã®æ å ±ãååŸããããšãã§ããŸãã
fsstat -o <offsetstart> /pat/to/filesystem-file.ext
#You can get the <offsetstart> with the "p" command inside fdisk
ç¡æã®GUIã¢ããªã±ãŒã·ã§ã³ã䜿çšã§ããŸãïŒhttps://www.disk-editor.org/index.html
ãŸãã¯ãpythonã䜿çšããŠã¹ãŒããŒãããã¯æ
å ±ãååŸããããšãã§ããŸãïŒhttps://pypi.org/project/superblock/
inodes
inodesã«ã¯ããã¡ã€ã«ã®å®éã®ããŒã¿ãå«ããããã¯ã®ãªã¹ããå«ãŸããŠããŸãã
ãã¡ã€ã«ã倧ããå Žåãinodeã«ã¯ãã¡ã€ã«ããŒã¿ãå«ããããã¯/ããå€ãã®inodeãæãä»ã®inodeãžã®ãã€ã³ã¿ãå«ãŸããå ŽåããããŸãã
Ext2ããã³Ext3ã§ã¯ãinodeã®ãµã€ãºã¯128Bã§ããExt4ã¯çŸåš156Bã䜿çšããŠããŸãããå°æ¥ã®æ¡åŒµãèš±å¯ããããã«ãã£ã¹ã¯äžã«256Bãå²ãåœãŠãŸãã
inodeã®æ§é ïŒ
ãªãã»ãã | ãµã€ãº | åå | 説æ |
---|---|---|---|
0x0 | 2 | ãã¡ã€ã«ã¢ãŒã | ãã¡ã€ã«ã¢ãŒããšã¿ã€ã |
0x2 | 2 | UID | ãªãŒããŒIDã®äžäœ16ããã |
0x4 | 4 | ãµã€ãº Il | ãã¡ã€ã«ãµã€ãºã®äžäœ32ããã |
0x8 | 4 | Atime | ãšããã¯ããã®ã¢ã¯ã»ã¹æéïŒç§åäœïŒ |
0xC | 4 | Ctime | ãšããã¯ããã®å€æŽæéïŒç§åäœïŒ |
0x10 | 4 | Mtime | ãšããã¯ããã®å€æŽæéïŒç§åäœïŒ |
0x14 | 4 | Dtime | ãšããã¯ããã®åé€æéïŒç§åäœïŒ |
0x18 | 2 | GID | ã°ã«ãŒãIDã®äžäœ16ããã |
0x1A | 2 | Hlink count | ããŒããªã³ã¯ã®æ° |
0xC | 4 | Blocks Io | ãããã¯æ°ã®äžäœ32ããã |
0x20 | 4 | ãã©ã° | ãã©ã° |
0x24 | 4 | Union osd1 | LinuxïŒIããŒãžã§ã³ |
0x28 | 69 | Block[15] | ããŒã¿ãããã¯ãžã®ãã€ã³ãïŒ15åïŒ |
0x64 | 4 | ããŒãžã§ã³ | NFSçšã®ãã¡ã€ã«ããŒãžã§ã³ |
0x68 | 4 | File ACL low | æ¡åŒµå±æ§ïŒACLãªã©ïŒã®äžäœ32ããã |
0x6C | 4 | File size hi | ãã¡ã€ã«ãµã€ãºã®äžäœ32ãããïŒext4ã®ã¿ïŒ |
0x70 | 4 | Obsolete fragment | å»æ¢ããããã©ã°ã¡ã³ãã¢ãã¬ã¹ |
0x74 | 12 | Osd 2 | 2çªç®ã®ãªãã¬ãŒãã£ã³ã°ã·ã¹ãã äŸåã®ãŠããªã³ |
0x74 | 2 | Blocks hi | ãããã¯æ°ã®äžäœ16ããã |
0x76 | 2 | File ACL hi | æ¡åŒµå±æ§ïŒACLãªã©ïŒã®äžäœ16ããã |
0x78 | 2 | UID hi | ãªãŒããŒIDã®äžäœ16ããã |
0x7A | 2 | GID hi | ã°ã«ãŒãIDã®äžäœ16ããã |
0x7C | 2 | Checksum Io | inodeãã§ãã¯ãµã ã®äžäœ16ããã |
ãModifyãã¯ããã¡ã€ã«ã®_å
容_ãæåŸã«å€æŽãããæéã®ã¿ã€ã ã¹ã¿ã³ãã§ããããã¯éåžžãmtimeããšåŒã°ããŸãã
ãChangeãã¯ããã¡ã€ã«ã®_inode_ãå€æŽãããæåŸã®æéã®ã¿ã€ã ã¹ã¿ã³ãã§ããããã¯ãã¢ã¯ã»ã¹èš±å¯ãæææš©ããã¡ã€ã«åãããŒããªã³ã¯ã®æ°ãªã©ãå€æŽããããšã«ãã£ãŠåŒã°ããããšããããŸããããã¯éåžžãctimeããšåŒã°ããŸãã
æ¡åŒµãããinodeã®æ§é ïŒExt4ïŒïŒ
ãªãã»ãã | ãµã€ãº | åå | 説æ |
---|---|---|---|
0x80 | 2 | Extra size | æšæºã®128ãã€ããè¶ ãããã€ãæ° |
0x82 | 2 | Checksum hi | inodeãã§ãã¯ãµã ã®äžäœ16ããã |
0x84 | 4 | Ctime extra | å€æŽæéã®è¿œå ããã |
0x88 | 4 | Mtime extra | å€æŽæéã®è¿œå ããã |
0x8C | 4 | Atime extra | ã¢ã¯ã»ã¹æéã®è¿œå ããã |
0x90 | 4 | Crtime | ãã¡ã€ã«äœææéïŒãšããã¯ããã®ç§æ°ïŒ |
0x94 | 4 | Crtime extra | ãã¡ã€ã«äœææéã®è¿œå ããã |
0x98 | 4 | Version hi | ããŒãžã§ã³ã®äžäœ32ããã |
0x9C | Unused | å°æ¥ã®æ¡åŒµã®ããã®äºçŽæžã¿ã¹ããŒã¹ |
ç¹æ®ãªinodeïŒ
Inode | ç¹æ®ãªç®ç |
---|---|
0 | ãã®ãããªinodeã¯ååšãããçªå·ä»ãã¯1ããéå§ãããŸã |
1 | æ¬ é¥ãããã¯ãªã¹ã |
2 | ã«ãŒããã£ã¬ã¯ã㪠|
3 | ãŠãŒã¶ãŒã¯ã©ãŒã¿ |
4 | ã°ã«ãŒãã¯ã©ãŒã¿ |
5 | ããŒãããŒã |
6 | åé€ããããã£ã¬ã¯ã㪠|
7 | äºçŽæžã¿ã°ã«ãŒãèšè¿°åïŒãã¡ã€ã«ã·ã¹ãã ã®ãµã€ãºå€æŽçšïŒ |
8 | ãžã£ãŒãã« |
9 | ã¹ãããã·ã§ããçšã®é€å€inode |
10 | ã¬ããªã«inode |
11 | æåã®éäºçŽinodeïŒãã°ãã°lost + foundïŒ |
{% hint style="info" %} äœææå»ã¯Ext4ã«ã®ã¿è¡šç€ºãããããšã«æ³šæããŠãã ããã {% endhint %}
inodeçªå·ãç¥ã£ãŠããå Žåããã®ã€ã³ããã¯ã¹ãç°¡åã«èŠã€ããããšãã§ããŸãïŒ
- inodeãæå±ãããããã¯ã°ã«ãŒãïŒïŒInodeçªå· - 1ïŒ/ïŒã°ã«ãŒãããšã®inodeæ°ïŒ
- ã°ã«ãŒãå ã®ã€ã³ããã¯ã¹ïŒïŒInodeçªå· - 1ïŒmodïŒInodes/ã°ã«ãŒãïŒ
- inodeããŒãã«ãžã®ãªãã»ããïŒInodeçªå· *ïŒInodeãµã€ãºïŒ
- "-1"ã¯ãinode 0ãæªå®çŸ©ïŒäœ¿çšãããŠããªãïŒã§ããããã§ãã
ls -ali /bin | sort -n #Get all inode numbers and sort by them
stat /bin/ls #Get the inode information of a file
istat -o <start offset> /path/to/image.ext 657103 #Get information of that inode inside the given ext file
icat -o <start offset> /path/to/image.ext 657103 #Cat the file
ãã¡ã€ã«ã¢ãŒã
æ°å | 説æ |
---|---|
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ïŒãã£ã¬ã¯ããªäžã®æžã蟌ã¿ãšå®è¡æš©éãæã€ãŠãŒã¶ãŒã¯ãã¡ã€ã«ãåé€ããã³ååå€æŽã§ããŸãïŒ |
8 | ãªãŒããŒã®èªã¿åãæš©é |
7 | ãªãŒããŒã®æžã蟌ã¿æš©é |
6 | ãªãŒããŒã®å®è¡æš©é |
5 | ã°ã«ãŒãã®èªã¿åãæš©é |
4 | ã°ã«ãŒãã®æžã蟌ã¿æš©é |
3 | ã°ã«ãŒãã®å®è¡æš©é |
2 | ãã®ä»ã®ãŠãŒã¶ãŒã®èªã¿åãæš©é |
1 | ãã®ä»ã®ãŠãŒã¶ãŒã®æžã蟌ã¿æš©é |
0 | ãã®ä»ã®ãŠãŒã¶ãŒã®å®è¡æš©é |
倪åã®ãããïŒ12ã13ã14ã15ïŒã¯ããã¡ã€ã«ã®çš®é¡ïŒãã£ã¬ã¯ããªããœã±ãããªã©ïŒã瀺ããŠããã倪åã®ãªãã·ã§ã³ã®ãããã1ã€ããååšããŸããã
ãã£ã¬ã¯ããª
ãªãã»ãã | ãµã€ãº | åå | 説æ |
---|---|---|---|
0x0 | 4 | Inode | |
0x4 | 2 | Rec len | ã¬ã³ãŒãã®é·ã |
0x6 | 1 | Name len | ååã®é·ã |
0x7 | 1 | File type | 0x00 äžæ 0x02 ãã£ã¬ã¯ã㪠0x03 æåããã€ã¹ 0x04 ãããã¯ããã€ã¹ 0x05 FIFO 0x06 ãœã±ãã 0x07 ã·ã³ããªãã¯ãªã³ã¯ |
0x8 | Name | ååã®æååïŒæ倧255æåãŸã§ïŒ |
ããã©ãŒãã³ã¹ãåäžãããããã«ãã«ãŒãããã·ã¥ãã£ã¬ã¯ããªãããã¯ã䜿çšããããšãã§ããŸãã
æ¡åŒµå±æ§
以äžã«ä¿åããããšãã§ããŸãã
- inodeå ã®file_aclãæãããŒã¿ãããã¯
- inodeã®éã®äœåãªã¹ããŒã¹ïŒ256 - inodeãµã€ãºãéåžžã¯100ïŒ
"ãŠãŒã¶ãŒ"ã§å§ãŸãååã®å ŽåããŠãŒã¶ãŒã®å±æ§ãšããŠä»»æã®ããŒã¿ãä¿åããããšãã§ããŸãããã®æ¹æ³ã§ããŒã¿ãé ãããšãã§ããŸãã
æ¡åŒµå±æ§ãšã³ããª
ãªãã»ãã | ãµã€ãº | åå | 説æ |
---|---|---|---|
0x0 | 1 | Name len | å±æ§åã®é·ã |
0x1 | 1 | Name index | 0x0 = ãã¬ãã£ãã¯ã¹ãªã 0x1 = user. ãã¬ãã£ãã¯ã¹ 0x2 = system.posix_acl_access 0x3 = system.posix_acl_default 0x4 = trusted. 0x6 = security. 0x7 = system. 0x8 = system.richacl |
0x2 | 2 | Value offs | æåã®inodeãšã³ããªãŸãã¯ãããã¯ã®éå§äœçœ®ããã®ãªãã»ãã |
0x4 | 4 | Value blocks | å€ãä¿åãããŠãããã£ã¹ã¯ãããã¯ããŸãã¯ãã®ãããã¯ã®å Žåã¯ãŒã |
0x8 | 4 | Value size | å€ã®é·ã |
0xC | 4 | Hash | ãããã¯å ã®å±æ§ã®ããã·ã¥ããŸãã¯inodeå ã®å Žåã¯ãŒã |
0x10 | Name | æ«å°Ÿã®NULLãå«ãŸãªãå±æ§å |
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"
ãã¡ã€ã«ã·ã¹ãã ã®è¡šç€º
ãã¡ã€ã«ã·ã¹ãã ã®å 容ã衚瀺ããã«ã¯ã次ã®æ¹æ³ããããŸãã
- ç¡æã®ããŒã«ã䜿çšããïŒhttps://www.disk-editor.org/index.html
- ãŸãã¯ã
mount
ã³ãã³ãã䜿çšããŠLinuxã«ããŠã³ãããããšãã§ããŸãã
âïž HackTricks Cloud âïž -ðŠ Twitter ðŠ - ðïž Twitch ðïž - ð¥ Youtube ð¥
-
ãµã€ããŒã»ãã¥ãªãã£äŒæ¥ã§åããŠããŸããïŒ HackTricksã§äŒç€Ÿã宣äŒãããã§ããïŒãŸãã¯ãPEASSã®ææ°ããŒãžã§ã³ãå ¥æãããã§ããïŒSUBSCRIPTION PLANSããã§ãã¯ããŠãã ããïŒ
-
The PEASS FamilyãèŠã€ããŠãã ãããç¬å çãªNFTã®ã³ã¬ã¯ã·ã§ã³ã§ãã
-
å ¬åŒã®PEASSïŒHackTricksã®ã°ããºãæã«å ¥ããŸãããã
-
ð¬ Discordã°ã«ãŒããŸãã¯telegramã°ã«ãŒãã«åå ããããTwitterã§ç§ããã©ããŒããŠãã ããðŠ@carlospolopm.
-
ãããã³ã°ã®ããªãã¯ãå ±æããã«ã¯ãhacktricksã®ãªããžããªãšhacktricks-cloudã®ãªããžããªã«PRãæåºããŠãã ããã