| 1 |
function has_tunable_string:long() |
| 2 |
{ |
| 3 |
name = "GLIBC_TUNABLES" |
| 4 |
|
| 5 |
mm = @task(task_current())->mm; |
| 6 |
if (mm) |
| 7 |
{ |
| 8 |
env_start = @mm(mm)->env_start; |
| 9 |
env_end = @mm(mm)->env_end; |
| 10 |
|
| 11 |
if (env_start != 0 && env_end != 0) |
| 12 |
while (env_end > env_start) |
| 13 |
{ |
| 14 |
cur = user_string(env_start, ""); |
| 15 |
env_name = tokenize(cur, "="); |
| 16 |
|
| 17 |
if (env_name == name && tokenize("", "") != "") |
| 18 |
return 1; |
| 19 |
env_start += strlen (cur) + 1 |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
return 0; |
| 24 |
} |
| 25 |
|
| 26 |
probe process("/lib*/ld*.so*").function("__tunables_init") |
| 27 |
{ |
| 28 |
atsecure = 0; |
| 29 |
/* Skip processing if we can't read __libc_enable_secure, e.g. core dump |
| 30 |
handler (systemd-cgroups-agent and systemd-coredump). */ |
| 31 |
try { atsecure = @var("__libc_enable_secure"); } |
| 32 |
catch { printk (4, sprintf ("CVE-2023-4911: Skipped check: %s (%d)", execname(), pid())); } |
| 33 |
if (atsecure && has_tunable_string ()) |
| 34 |
raise (9); |
| 35 |
} |