Linux /etc/passwd 文件权限配置不当漏洞

漏洞信息

漏洞名称: Linux /etc/passwd 文件权限配置不当漏洞

漏洞类型: 配置问题

漏洞等级: 高危

漏洞描述: 该漏洞涉及Linux操作系统中的/etc/passwd文件权限配置不当问题。/etc/passwd文件是Linux系统中存储用户账户信息的关键文件,包括用户名、用户ID、组ID、家目录和登录shell等信息。正常情况下,该文件应由root用户拥有,并且权限设置为644或更严格,以防止未授权的修改。如果非root用户能够修改此文件,攻击者可能通过添加或修改用户账户信息,获得未授权的shell访问权限或进行权限提升。此漏洞的技术根源在于文件权限配置不当,未遵循最小权限原则。攻击者利用此漏洞可以在本地进行权限提升,进而执行任意代码或访问敏感信息,对系统安全构成严重威胁。由于此漏洞利用不需要用户交互,且可以自动化执行,因此其潜在影响较大,特别是在多用户环境或共享主机中。

产品名称: Linux操作系统

来源: https://github.com/projectdiscovery/nuclei-templates/blob/dfc176303ffebe3d9f231045fa3abe2cf2ca9874/misconfiguration%2Flinux%2Fetc-passwd-permission-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

id: etc-passwd-permission-check

info:
name: /etc/passwd File Owner and Permission Check
author: songyaeji
severity: high
description: >
If a user other than root can modify the /etc/passwd file, it may allow unauthorized shell access or privilege escalation. This template checks that the file is owned by root and has permission 644 or less.
reference:
- https://isms.kisa.or.kr/main/csap/notice/
- Cloud Vulnerability Assessment Guide (2024) by KISA
tags: linux,local,permission,file,passwd,compliance
metadata:
verified: true
os: linux
max-request: 1
classification:
cwe-id: CWE-732
cvss-metrics: CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
cvss-score: 7.0

self-contained: true

code:
- engine:
- bash
source: |
stat -c "%U %G %a" /etc/passwd 2>/dev/null || echo "not-found"
matchers:
- type: regex
part: code_1_response
regex:
- '^root\s+root\s+(6[0-4][0-4]|64[0-4]|[0-5][0-9]{2}|[0-9]{1,2})$'


Linux /etc/passwd 文件权限配置不当漏洞
http://example.com/2025/07/31/github_89708198/
作者
lianccc
发布于
2025年7月31日
许可协议