T06 · System Persistence
- Location
scripts/install.sh:316- Finding
Installer Enables Persistent Background Execution
- Content
View full analysis
> "$LOGFILE" 2>&1 & ``` ```c /* scripts/memwatchd.c:181-186 */ if (g_pending) { time_t now = time(NULL); if (now - g_last_trigger >= DEBOUNCE_SECS) { g_pending = 0; run_refresh(workspace); } } ``` The invoked refresh operation executes the workspace script as follows: ```c /* scripts/memwatchd.c:73-106 */ static void run_refresh(const char *workspace) { char script[PATH_MAX]; snprintf(script, sizeof(script), "%s/memory-upgrade/graph_refresh.py", workspace); /* Check script exists */ struct stat st; if (stat(script, &st) != 0) { fprintf(stderr, "[memwatchd] refresh script not found: %s\n", script); return; } pid_t pid = fork(); if (pid < 0) { fprintf(stderr, "[memwatchd] fork failed: %s\n", strerror(errno)); return; } if (pid == 0) { /* Child: redirect stdout/stderr to /dev/null for quiet operation */ int devnull = open("/dev/null", O_WRONLY); if (devnull >= 0) { dup2(devnull, STDOUT_FILENO); dup2(devnull, STDERR_FILENO); close(devnull); } /* Find python3 */ char *python = "/home/node/.local/bin/python3"; struct stat ps; if (stat(python, &ps) != 0) { python = "/usr/bin/python3"; } execl(python, "python3", script, "--quiet", (char *)NULL); _ ...[truncated 2202 chars]- Remediation
View remediation
