Linux Cron 文件所有权和权限配置问题

漏洞信息

漏洞名称: Linux Cron 文件所有权和权限配置问题

漏洞类型: 配置问题

漏洞等级: 高危

漏洞描述: 该漏洞涉及Linux系统中的Cron服务,具体为/etc/cron.allow和/etc/cron.deny文件的权限和所有权配置不当。Cron是Linux系统中用于定时执行任务的守护进程,广泛用于服务器和桌面系统,以实现自动化任务调度。当这些关键配置文件的所有权不为root或权限设置不当(如权限大于640)时,可能会导致未授权用户能够添加或修改定时任务,从而可能引发系统被入侵或服务拒绝攻击。漏洞的技术根源在于对关键系统文件的访问控制不足,未能严格执行最小权限原则。这种配置问题可能允许攻击者通过添加恶意定时任务来执行任意代码,进而控制受影响的系统或破坏系统稳定性。由于Cron服务在Linux系统中的普遍使用,此类漏洞的影响范围广泛,且攻击者无需事先认证即可利用,增加了安全风险。

产品名称: Linux Cron

来源: https://github.com/projectdiscovery/nuclei-templates/blob/1dc5e4c5a7e3689548a72d7cb2a00b803fccc824/misconfiguration%2Flinux%2Flinux-cron-ownership-perms-check.yaml

类型: projectdiscovery/nuclei-templates:github issues

POC详情

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

id: linux-cron-file-permissions

info:
name: Cron File Ownership and Permissions Check
author: songyaeji
severity: high
description: >
Checks whether /etc/cron.allow and /etc/cron.deny files have proper ownership (root)
and permission (640). Misconfigured cron access files may allow unauthorized users
to schedule cron jobs, which could result in system compromise or denial of service.
reference:
- https://isms.kisa.or.kr
- Cloud Vulnerability Assessment Guide(2024) by KISA
tags: linux,cron,permissions,misconfiguration,local
metadata:
verified: true
os: linux
max-request: 1
classification:
cvss-metrics: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
cvss-score: 7.8
cwe-id: CWE-732

self-contained: true

code:
- engine:
- bash
source: |
result=""
if [ -f /etc/cron.allow ]; then
owner=$(stat -c "%U" /etc/cron.allow)
perm=$(stat -c "%a" /etc/cron.allow)
if [ "$owner" != "root" ] || [ "$perm" -gt 640 ]; then
result+="[WARN] /etc/cron.allow misconfigured\n"
fi
fi

if [ -f /etc/cron.deny ]; then
owner=$(stat -c "%U" /etc/cron.deny)
perm=$(stat -c "%a" /etc/cron.deny)
if [ "$owner" != "root" ] || [ "$perm" -gt 640 ]; then
result+="[WARN] /etc/cron.deny misconfigured\n"
fi
fi

if [ -n "$result" ]; then
echo -e "$result"
else
echo "[OK] cron files properly configured"
fi
matchers:
- type: word
part: code_1_response
words:
- "[WARN] /etc/cron.allow misconfigured"
- "[WARN] /etc/cron.deny misconfigured"


Linux Cron 文件所有权和权限配置问题
http://example.com/2025/07/29/github_3711145868/
作者
lianccc
发布于
2025年7月29日
许可协议