English | 中文
Lowers the inode of a target path inside the same filesystem on Android /data by renaming directories, so that the target inherits a low inode from a candidate directory while both keep their original contents.
Current version: v2.3.1
This is a root filesystem tool. Replacing a directory inode means existing inotify watches, open directory file descriptors, and process working directories keep pointing at the old object. Use it in a maintenance environment; it cannot guarantee that every OEM service completes unnoticed.
Target directory inode: 2382509
Candidate directory: 628
1. rename both sides' direct children out of the way on the same partition;
2. exchange the paths of the two now-empty root directories;
3. restore both sides' original uid/gid, mode, and SELinux context;
4. rename each side's original contents back to its own path;
5. verify the final inode and the SELinux context of both roots.
Children are moved with same-partition rename, never copied with cp -a. Regular files, hidden files, and symlinks all keep their inode, ownership, SELinux xattr, and other xattrs. The target directory itself ends up using the candidate's low inode.
- Non-empty
/data/local/tmpallowed: the original contents of both the target and the candidate are preserved transactionally; - Atomic swap enforced: always calls
/system/bin/toybox mv -x(RENAME_EXCHANGE); a plainmvmay no longer degrade to copy+delete when rename fails; - Pre-flight self-test: two test directories are used first to confirm that
mv -xreally exchanges inodes; the real target is untouched if it fails; - Dangerous "safe" entries removed:
cota,oplus_lib,opluscvtnvmand similar are now hard-denied; engineering, OTA, log, and theme directories are downgraded to caution; - Name wildcards no longer grant safety:
*cache*,*backup*,*test*etc. can only enter the unknown list; - Unknown is never the default recommendation: it can only be chosen manually, and requires typing the literal uppercase
SWAP; - Symlinks, mount points, and cross-filesystem candidates are rejected;
- Re-validation before execution: candidate type, inode, filesystem device number, and mount state;
- SELinux fail-closed: a failed
restorecon, or a context mismatch after restore, aborts immediately and attempts a rollback; - Safe transaction directory:
mktempwith0700permissions instead of a fixed temporary name; - Numeric UID/GID: avoids restore failures when an OEM UID has no name mapping;
- Failure keeps the scene intact: if a safe automatic rollback is impossible, transaction data is not deleted and a manual recovery path is printed.
App data, root data, encryption/multi-user directories, DRM/NVM, carrier configuration, dynamic OEM libraries, and OTA/rollback core paths never appear in the candidate list.
Engineering mode, camera engineering, logs, dumps, theme backups, and OTA staging may be used by OEM services. Only empty directories take part in default candidate scoring; non-empty entries remain manually selectable by users who understand their own device.
Directories that cannot be proven safe by name alone. Unknown entries are never the enter-key default.
su -c sh /path/to/Inode-Hijacker-v2.3.1.shSpecify the target and the maximum candidate inode:
su -c sh /path/to/Inode-Hijacker-v2.3.1.sh /data/local/tmp 10000- Rooted Android;
- SELinux available, with
restoreconprovided by the device; - target and candidate on the same filesystem under
/data; - preferably stop services that continuously access the target or candidate directory;
- back up important data first;
- do not run during an OTA, data migration, log capture, or OEM engineering test.
- Once a directory inode has been replaced, existing inotify watches, directory fds, and cwds do not migrate to the new inode;
- only the two root directories' expected path SELinux contexts are validated; children keep their original xattrs because they are moved by rename, and are not recursively relabeled;
- root and kernel modules in the same SELinux domain can still interfere with the transaction; the tool gives no absolute guarantee against a malicious EL1 or concurrent root writes;
- OEM directory semantics vary by device and firmware, so the risk table is a default-deny/hint mechanism, not a substitute for checking device-level source.
YiJieqwq — released under the MIT License.