{"record":{"id":"324846eb0a0837b1","repo":"shadow1ng/fscan","slug":"s-ldpreload-shell-config-modify-none","errorCode":null,"errorMessage":"%s [ldpreload_shell_config_modify_none]","messagePattern":"(.+?) \\[ldpreload_shell_config_modify_none\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/ldpreload.go","lineNumber":255,"sourceCode":"\t\t// 检查是否已存在\n\t\tif strings.Contains(content, libPath) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// 添加新行\n\t\tif !strings.HasSuffix(content, \"\\n\") && content != \"\" {\n\t\t\tcontent += \"\\n\"\n\t\t}\n\t\tcontent += ldPreloadLine + \"\\n\"\n\n\t\t// 写入文件\n\t\tif err := os.WriteFile(configFile, []byte(content), 0644); err == nil {\n\t\t\tmodified = append(modified, configFile)\n\t\t}\n\t}\n\n\tif len(modified) == 0 {\n\t\treturn nil, fmt.Errorf(\"%s\", i18n.GetText(\"ldpreload_shell_config_modify_none\"))\n\t}\n\n\treturn modified, nil\n}\n\n// createLdConfig 创建ld预加载配置\nfunc (p *LDPreloadPlugin) createLdConfig(libPath string) error {\n\tconfigFile := \"/etc/ld.so.preload\"\n\n\t// 读取现有内容\n\tcontent := \"\"\n\tif data, err := os.ReadFile(configFile); err == nil {\n\t\tcontent = string(data)\n\t}\n\n\t// 检查是否已存在\n\tif strings.Contains(content, libPath) {\n\t\treturn nil","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/ldpreload.go#L237-L273","documentation":"Raised in addToShellConfigs when no shell config file (~/.bashrc, ~/.profile, etc.) could be modified — none existed/were writable, or every candidate already failed the write — so the LD_PRELOAD export line was not persisted anywhere.","triggerScenarios":"Thrown at plugins/local/ldpreload.go:255 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check write permissions on the target user's shell rc files","Create a shell rc file if none exists","Use /etc/ld.so.preload (createLdConfig) as the persistence channel instead"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}