Researcher: Ali Firas (thesmartshadow)
Target: jtsylve/LiME (Linux Memory Extractor)
Tested lab:
Linux lime-lab 7.0.0-27-generic #27-Ubuntu SMP PREEMPT_DYNAMIC Thu Jun 18 19:13:49 UTC 2026 x86_64 GNU/Linux
LiME source tree: /home/ali/LiME
Build target: /home/ali/LiME/src/lime-7.0.0-27-generic.ko
LiME is a loadable kernel module for acquiring volatile memory from Linux and Android systems. Two documented output modes expose high-impact security issues when LiME is used during incident response or forensic acquisition:
- Unauthenticated TCP memory acquisition: LiME's documented TCP mode binds to all interfaces by default and streams the full physical memory image to the first TCP client, without authentication or receiver verification.
- Unsafe disk output path handling: LiME opens operator-supplied disk output paths from kernel/root context with
O_CREAT | O_TRUNCand mode0444, withoutO_NOFOLLOWor regular-file validation. This enables root-owned file clobbering through attacker-controlled symlinks and creates world-readable RAM dumps.
The TCP issue is the strongest CVE/GHSA candidate because it follows the documented workflow directly and requires no special parser harness: a network-adjacent client can receive the target's physical memory dump.
The disk issue is a separate local impact chain. The root-owned file overwrite is deterministic when a privileged operator writes to an attacker-controlled path. A safe OpenSSH parser demonstration further shows that attacker-controlled process memory can be written into a root-owned parser-consumed file and accepted by a privileged service, resulting in root command execution. That LPE proof is intentionally scoped as parser-mediated impact amplification, not as a precise arbitrary file write.
This report is written to match the evidence reviewers usually need:
- Specific public codebase: LiME is publicly released source code, and the affected code paths are in
src/tcp.c,src/main.c,src/disk.c, andsrc/hash.c. - Clear vulnerability type: missing authentication for a critical memory acquisition stream; improper link resolution before file access; unsafe permission assignment for sensitive output.
- Security impact: disclosure of full physical memory, local disclosure of root-owned RAM dumps, root-owned file clobbering, and parser-mediated local privilege escalation.
- Reproducible proof: VM proofs include source references, runtime output, kprobe/kernel-stack evidence, and full PoC scripts.
- Remediation path: safe defaults, explicit opt-in for risky behavior,
O_NOFOLLOW,0600output files, regular-file validation, and regression tests.
GitHub states that repository security advisories are used to privately discuss and fix vulnerabilities and that GitHub can assign CVE identifiers for eligible advisories in public repositories. GitHub's advisory workflow asks for affected versions and recommends adding a fixed version when possible before publication:
- https://docs.github.com/en/code-security/concepts/vulnerability-reporting-and-management/repository-security-advisories
- https://docs.github.com/en/code-security/how-tos/report-and-fix-vulnerabilities/fix-reported-vulnerabilities/publish-repository-advisory
NVD describes CVEs as identifiers for vulnerabilities in specific code bases and notes that CVE records include vulnerability type, vendor/product, affected code base, expected impact, attack vector, and remediation state:
LiME TCP acquisition mode exposes full physical memory to an unauthenticated first client.
src/main.csrc/tcp.c- documented
path=tcp:<port>acquisition mode
LiME's TCP mode accepts a module parameter such as path=tcp:4444. The module creates a kernel TCP listener, binds to all interfaces by default, listens with a backlog of 1, and accepts the first client. There is no authentication, no authorization, no receiver identity check, and no shared secret.
Documentation explicitly states that localhostonly=0 binds on all interfaces and is the default:
README.md:85-87
localhostonly (optional):
1 ~ restricts tcp to only listen on localhost
0 ~ binds on all interfaces (default)
The documented Linux TCP workflow is:
README.md:111
insmod ./lime-$(uname -r).ko "path=tcp:4444 format=lime"
README.md:117
nc <target-ip> 4444 > ram.lime
The deeper documentation repeats the same behavior:
docs/README.md:186-188
localhostonly Optional. 1 restricts the tcp to only
listen on localhost, 0 binds on all
interfaces (default)
docs/README.md:205
insmod ./lime-$(uname -r).ko "path=tcp:4444 format=lime"
docs/README.md:212
nc <target-ip> 4444 > ram.lime
Relevant code:
// src/main.c
int localhostonly = 0;
module_param(localhostonly, int, S_IRUGO);
// src/tcp.c
if (localhostonly) {
saddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
} else {
saddr.sin_addr.s_addr = htonl(INADDR_ANY);
}
r = kernel_listen(control, 1);
r = kernel_accept(control, &accept, 0);LiME does not stream an ordinary log file. It streams the target's physical memory image from kernel context. The memory image can contain:
- root-owned process memory
- credentials, tokens, API keys, session material
- encryption keys
- forensic evidence and private application data
- kernel and user-space memory artifacts
The first client that connects receives that data. If an attacker can reach the listening port before the intended collector, the attacker wins the acquisition stream.
The lab PoC placed a unique marker inside a root-owned process, started LiME in TCP mode, and connected from an external Kali host on the same network.
Listener proof:
LISTEN 0 1 0.0.0.0:4444 0.0.0.0:*
External client proof:
FOUND_ROOT_MEMORY_MARKER_OVER_NETWORK=YES
LIME_TCP_RING0_EXFIL_1783874809_daf3fc71-b83d-4b01-adec-506349ceb221_END
bytes_received=4294421600
This shows that an unauthenticated network client received the full LiME memory stream and recovered data that existed only in a root-owned process memory buffer.
A kprobe on kernel_bind() and kernel_accept() captured the TCP path:
LISTEN 0 1 0.0.0.0:4445 0.0.0.0:*
first_32_bytes=454d694c010000000010000000000000fffb0900000000000000000000000000
The first bytes are the LiME header magic in little-endian form:
45 4d 69 4c = 0x4C694D45
The kernel_bind kprobe captured an all-interface bind:
lime_kernel_bind: (kernel_bind+0x0/0xa0) family=2 port=23825 addr=0
family=2 is AF_INET; addr=0 is INADDR_ANY; the displayed port is the network-byte-order value read directly from struct sockaddr_in.
The stack shows the operation originates from LiME module initialization:
=> kernel_bind
=> lime_init_module
=> do_one_initcall
=> do_init_module
=> load_module
=> init_module_from_file
=> idempotent_init_module
=> __x64_sys_finit_module
=> x64_sys_call
=> do_syscall_64
=> entry_SYSCALL_64_after_hwframe
A network-adjacent attacker can connect before the intended forensic collector and receive a full physical memory dump without credentials.
- CWE-306: Missing Authentication for Critical Function
- CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Primary score, evaluating the listening state:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N = 7.5 High
I do not rely on UI:R for the TCP issue. The operator's act of starting a documented acquisition mode is better treated as the vulnerable product state being enabled. The unauthenticated network client does not need to trick a user into opening attacker-supplied content.
- Bind TCP acquisition to loopback by default.
- Require explicit opt-in for all-interface binding.
- Add receiver authentication, for example a one-time token passed as a module parameter and verified before streaming memory.
- Consider refusing TCP mode without either
localhostonly=1or an explicitunsafe_all_interfaces=1. - Add regression tests for default bind behavior and
localhostonly.
LiME disk output follows attacker-controlled symlinks, allowing root-owned file clobbering and parser-mediated local privilege escalation.
src/disk.csrc/hash.csidecar digest path- documented local disk acquisition mode
The deterministic symlink overwrite should not be presented as a generic /tmp symlink exploit on hardened default Linux distributions. Modern Ubuntu, Debian, and RHEL-style systems commonly run with fs.protected_symlinks=1; in that configuration, a symlink planted in a sticky world-writable directory such as /tmp and pointing to a root-owned target is expected to be blocked by the kernel.
The reliable disk-overwrite/LPE PoC therefore uses an operator-supplied path= inside a directory owned by the unprivileged attacker, for example /home/limeattacker/lime-ssh-out. The realistic remaining scope is:
- the privileged LiME operator stages acquisition output inside a directory fully controlled by the subject or local attacker;
- the target system, container, or appliance has symlink protections disabled or unavailable, such as
fs.protected_symlinks=0; - an embedded or Android-style acquisition workflow uses writable external storage. LiME itself documents Android disk acquisition to
/sdcard/ram.lime.
The documented /tmp/ram.lime example still supports the world-readable dump issue for newly created files, but it should not be used as the primary claim for root-owned symlink overwrite on hardened default Linux systems.
LiME accepts a filesystem path through the path= module parameter and opens it from kernel/root context:
// src/disk.c
int oflags = O_WRONLY | O_CREAT | O_LARGEFILE | O_TRUNC;
...
f = filp_open(path, oflags, 0444);The disk path is not protected with O_NOFOLLOW, and there is no post-open validation that the final object is a regular trusted file. The file is created with mode 0444, making newly-created memory dumps world-readable on typical systems.
The same unsafe disk setup is reused for digest sidecar output:
// src/hash.c
snprintf(p, len, "%s.%s", path, digest);
if (setup_disk(p, 0)) {
ret = LIME_DIGEST_FAILED;
goto out;
}LiME documents local disk acquisition to /tmp/ram.lime:
README.md:105
insmod ./lime-$(uname -r).ko "path=/tmp/ram.lime format=lime"
docs/README.md:245-248
Disk-based acquisition may be preferred when the investigator
wants to avoid overwriting network buffers. Set the path
parameter to a file path to write the memory image directly
to disk.
docs/README.md:253
insmod ./lime-$(uname -r).ko "path=/tmp/ram.lime format=lime"
The project also documents Android and external-storage acquisition:
README.md:120-133
insmod /sdcard/lime.ko "path=/sdcard/ram.lime format=lime"
docs/README.md:256-263
On Android, the SD card is a common destination.
insmod /sdcard/lime.ko "path=/sdcard/ram.lime format=lime"
If a privileged operator writes to an attacker-controlled path, a local attacker can pre-create that path as a symlink to a root-owned file. LiME follows the symlink from kernel/root context, truncates the target, and writes the physical memory image into it.
This is not a precise arbitrary-write primitive. It is a destructive root-owned file clobber primitive whose content is the physical memory stream.
The lab PoC used an attacker-controlled path:
lrwxrwxrwx 1 limeattacker limeattacker ... /home/limeattacker/lime-out.lime -> /root/lime-root-owned-sentinel.txt
After LiME ran:
after: owner=root group=root mode=600 size=4294421600 path=/root/lime-root-owned-sentinel.txt
00000000: 45 4d 69 4c 01 00 00 00 ...
[+] ROOT_OWNED_FILE_OVERWRITTEN_THROUGH_ATTACKER_SYMLINK=YES
The target file was root-owned, and its first bytes became the LiME memory dump header.
A kprobe on filp_open() captured the unsafe open from LiME:
lime_showcase_filp_open: (filp_open+0x0/0x50)
filename="/home/limeattacker/lime-ssh-out" flags=0x8241 mode=0x124
The values decode to:
flags=0x8241 = O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE
mode=0x124 = octal 0444
Stack:
=> filp_open
=> lime_init_module
=> do_one_initcall
=> do_init_module
=> load_module
=> init_module_from_file
=> idempotent_init_module
=> __x64_sys_finit_module
=> x64_sys_call
=> do_syscall_64
=> entry_SYSCALL_64_after_hwframe
The safe PoC does not modify the real /root/.ssh/authorized_keys. Instead, it writes to /root/.ssh/authorized_keys_lime_poc and starts an isolated sshd instance on 127.0.0.1:2222 that reads only that test file.
The PoC placed an OpenSSH authorized_keys-compatible forced-command line in an unprivileged attacker's resident process memory. LiME then wrote the physical memory stream into the root-owned target file through the attacker-controlled symlink.
Proof excerpt:
owner=root group=root mode=444 size=2566426624 path=/root/.ssh/authorized_keys_lime_poc
marker found at byte offset 22670543
attacker SSH key blob found at byte offset 22670473
marker-to-key delta -70 bytes (key precedes marker)
Hex window around controlled memory:
0159eccf 4c 49 4d 45 5f 4d 45 4d 4f 52 59 5f 48 55 4e 54 |LIME_MEMORY_HUNT|
0159ed0f 5f 45 4e 44 0a 63 6f 6d 6d 61 6e 64 3d 22 2f 62 |_END.command="/b|
0159ed1f 69 6e 2f 73 68 20 2d 63 20 27 69 64 20 3e 20 2f |in/sh -c 'id > /|
0159ed3f 6f 66 3b 20 65 63 68 6f 20 4c 49 4d 45 5f 53 53 |of; echo LIME_SS|
OpenSSH proof:
ssh_exit=0
uid=0(root) gid=0(root) groups=0(root)
LIME_SSH_LPE_YES
[+] LOCAL_PRIVILEGE_ESCALATION_VIA_AUTHORIZED_KEYS=YES
The LPE proof is parser-mediated and probabilistic. The attacker does not control the exact file offset. The exploit relies on two properties:
- LiME dumps resident physical memory, including the unprivileged attacker's process memory.
- Some privileged parsers, such as OpenSSH authorized_keys, tolerate unrelated bytes and scan for valid records.
The successful laboratory run used the following memory-spray parameters:
| Measurement | Observed value |
|---|---|
| Configured attacker spray | 768 MiB |
| VM physical RAM | 3.32 GiB |
| Spray as a fraction of RAM | 22.6% |
| Result | Marker and OpenSSH authorized_keys record recovered; isolated OpenSSH authentication succeeded |
The 22.6% figure describes the recorded VM run, not a universal reliability threshold. No success-rate curve has been measured yet across 8 GiB, 16 GiB, larger production hosts, ulimit, or cgroup memory limits. Future validation should record the minimum spray ratio that gives reliable recovery, for example >90% success, on larger-memory systems.
The root-owned file clobber is deterministic. The placement of attacker-controlled bytes inside the memory stream is demonstrated but should not be described as a precise arbitrary write.
New disk output files are created with mode 0444. A separate lab proof showed a non-root user reading a root-created memory dump and recovering a marker from a root-owned process:
owner=root group=root mode=444 path=/var/tmp/lime-ghsa-proof.lime
uid=1001(limeattacker) gid=1001(limeattacker)
BEGIN_LIME_GHSA_1783874017_027a7570-3603-43fe-b141-e83e1ab0f410_END
[+] NON_ROOT_CAN_READ_ROOT_MEMORY_SECRET=YES
- CWE-59: Improper Link Resolution Before File Access ('Link Following')
- CWE-73: External Control of File Name or Path
- CWE-732: Incorrect Permission Assignment for Critical Resource
- CWE-200: Exposure of Sensitive Information
Primary CVSS 4.0 request for the disk-output chain:
CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Rationale: AT:P captures the real precondition: the privileged acquisition must use an attacker-controlled output path or a system without effective symlink protection. UI:N is intentional here; the attacker does not need a victim to open attacker-supplied content. The operator's LiME invocation is the vulnerable acquisition state, not the attacker's interaction step.
Legacy CVSS 3.1 reference, if the reviewer requires 3.1:
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H = 7.3 High
If a deployment runs automated or scheduled LiME acquisition to a predictable attacker-writable path, the 3.1 UI:N variant can be argued:
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H = 8.1 High
- Open disk outputs with
O_NOFOLLOW. - Create new dump files with
0600, not0444. - Reject symlink targets and non-regular files.
- Refuse predictable paths in world-writable directories unless an explicit unsafe option is set.
- Consider
openat2()withRESOLVE_NO_SYMLINKS/RESOLVE_BENEATHon kernels where it is available. - Apply the same protections to digest sidecar files.
- Add regression tests for symlink paths, output permissions,
dio=1, digest sidecar output, TCP default bind behavior, andlocalhostonly.
The repository's test architecture explicitly states that some relevant behaviors are not tested:
docs/test-architecture.md:170-176
What Is Not Tested
- TCP transport (network streaming)
- Direct I/O (`dio=1`)
- `localhostonly` parameter
- Memory edge cases (sparse RAM layouts, large gaps)
- Performance or stress testing
This is not itself a vulnerability, but it explains why the unsafe default TCP bind, unauthenticated stream, and disk-output edge cases were not caught by the current test harness.
I recommend two advisories or two CVEs, because the root causes, attack surfaces, and fixes are distinct:
-
Unauthenticated TCP physical memory disclosure
- Attack surface: network
- Primary impact: full RAM disclosure
- Root cause: no authentication and all-interface bind by default
- Suggested CVSS:
7.5 High
-
Unsafe disk output path handling
- Attack surface: local filesystem path
- Primary impact: root-owned file clobber, world-readable RAM dumps, parser-mediated LPE
- Root cause: symlink-following
filp_open()withO_TRUNCand mode0444 - Suggested CVSS: primary CVSS 4.0 vector
CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N; legacy CVSS 3.1 reference7.3 High
LiME before a fixed version exposes physical memory over unauthenticated TCP acquisition. The documented path=tcp:<port> mode binds to all interfaces by default and streams the full memory image to the first connecting client without authentication, allowing a network-adjacent attacker to obtain sensitive kernel and user-space memory.
LiME before a fixed version follows symlinks for disk acquisition output paths and creates memory dump files with unsafe permissions. A local attacker who can influence the output path can cause LiME, running in kernel/root context, to truncate or create a root-owned target file and write the physical memory stream into it. This can disclose sensitive memory, corrupt security-sensitive files, and enable parser-mediated local privilege escalation when attacker-controlled memory bytes are interpreted by a privileged parser.
The OpenSSH proof intentionally uses a dedicated test file and isolated local sshd to avoid modifying the real root SSH configuration. The demonstration proves the parser-mediated impact while keeping the lab safe and reproducible. It should not be described as a universal, exact-offset arbitrary write.