IPC Namespace
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Basic Information
An IPC (Inter-Process Communication) namespace is a Linux kernel feature that provides isolation of System V IPC objects, such as message queues, shared memory segments, and semaphores. This isolation ensures that processes in different IPC namespaces cannot directly access or modify each other's IPC objects, providing an additional layer of security and privacy between process groups.
How it works:
When a new IPC namespace is created, it starts with a completely isolated set of System V IPC objects. This means that processes running in the new IPC namespace cannot access or interfere with the IPC objects in other namespaces or the host system by default.
IPC objects created within a namespace are visible and accessible only to processes within that namespace. Each IPC object is identified by a unique key within its namespace. Although the key may be identical in different namespaces, the objects themselves are isolated and cannot be accessed across namespaces.
Processes can move between namespaces using the
setns()
system call or create new namespaces using theunshare()
orclone()
system calls with theCLONE_NEWIPC
flag. When a process moves to a new namespace or creates one, it will start using the IPC objects associated with that namespace.
Lab:
Create different Namespaces
CLI
By mounting a new instance of the /proc
filesystem if you use the param --mount-proc
, you ensure that the new mount namespace has an accurate and isolated view of the process information specific to that namespace.
Docker
Check which namespace is your process in
Find all IPC namespaces
Enter inside an IPC namespace
Also, you can only enter in another process namespace if you are root. And you cannot enter in other namespace without a descriptor pointing to it (like /proc/self/ns/net
).
Create IPC object
References
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Last updated