Wp Hardening Best Practicesのロゴ

Wp Hardening Best Practices

組織
wpultimatesecurity
wp-hardening-best-practices

WordPressサイトの設定やセキュリティ強化、wp-config.phpの編集、.htaccessやnginxルールの作成、ファイル権限の設定、デプロイ時のセキュリティに関する助言を行うときに使います。セキュリティキー、DISALLOW_FILE_EDIT、FORCE_SSL_ADMIN、デバッグ情報の出力無効化、uploads内でのPHP実行ブロック、機密ファイルの保護、最小権限に基づくファイル権限を扱います。サイトの設定時や見直し時には、先回りして適用してください。

Add to TypingMind

概要

公開者wpultimatesecurity
リポジトリWordPress-Security-Skills
スキル名wp-hardening-best-practices
スター
54
フォーク
3
同梱ファイル
4
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 4個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    wpultimatesecurityがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Wp Hardening Best Practices」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/wpultimatesecurity/WordPress-Security-Skills/tree/dev/skills/wp-hardening-best-practices
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wpultimatesecurity/WordPress-Security-Skills.git /tmp/WordPress-Security-Skills
mkdir -p .claude/skills
cp -r /tmp/WordPress-Security-Skills/skills/wp-hardening-best-practices .claude/skills/wp-hardening-best-practices
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでWp Hardening Best Practicesを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にWp Hardening Best Practicesを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Wp Hardening Best Practicesは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

WordPress hardening best practices

When to use this skill

Use this skill for site/environment configuration, as opposed to plugin code:

  • Editing wp-config.php (keys, constants, debug).
  • Writing/reviewing .htaccess (Apache) or server-block (nginx) rules.
  • Setting filesystem permissions and ownership.
  • Locking down wp-admin, XML-RPC, REST user enumeration, and the uploads dir.
  • Pre-launch hardening checklists and deployment review.

This complements the secure-coding skills: even perfect code runs on a host that must be configured to fail safely.

Core principles (and why they matter)

  1. Disable in-dashboard file editing in production. DISALLOW_FILE_EDIT removes the plugin/theme editor — a single compromised admin session otherwise becomes code execution.
  2. Force TLS for admin and logins. FORCE_SSL_ADMIN stops credentials and cookies traveling in cleartext.
  3. Never display errors in production. Stack traces leak paths, queries, and secrets. WP_DEBUG off, display_errors off; log to a non-web-readable file if needed.
  4. Block PHP execution where only data should live. An attacker who slips a PHP file into wp-content/uploads gets RCE unless the server refuses to execute it there.
  5. Protect sensitive files. wp-config.php, .htaccess, readme.html, debug.log, and dotfiles should not be web-readable.
  6. Least privilege on the filesystem. Files 644, directories 755, wp-config.php 640/600; web server should not own files it doesn't need to write.
  7. Unique, strong security keys/salts. They invalidate stolen cookies; regenerate if leaked.
  8. Reduce attack surface. Disable XML-RPC if unused, block user enumeration, keep core/ plugins/themes updated, remove unused plugins.

Step-by-step implementation

  1. In wp-config.php: set unique salts, DISALLOW_FILE_EDIT, FORCE_SSL_ADMIN, disable debug display; optionally WP_AUTO_UPDATE_CORE, DISALLOW_FILE_MODS for locked builds.
  2. Place wp-config.php permissions at 640/600; ensure it is above or protected from the web root.
  3. Add server rules to deny PHP in uploads, protect sensitive files, and (optionally) restrict wp-admin/xmlrpc.php.
  4. Set file/dir permissions to least privilege.
  5. Keep everything updated; remove what you don't use.
  6. Add abuse controls for public surfaces: comment moderation on, pingbacks off if unused, and — for bot-heavy sites — CAPTCHA/Turnstile on login and registration via an established plugin (hand-rolled CAPTCHAs fail in both directions). Pair with the login throttle from authentication-session-security; XML-RPC stays off unless needed.

Supporting references

ReferenceLoad when
WordPress hardening checklistBefore final verification of the wordpress hardening controls.
Pre-launch (go-live) checklistReviewing a production launch across configuration, code, data, and operations.
Apache and nginx hardening rulesImplementing server hardening for sensitive files, uploads, and restricted endpoints.
Hardened wp-config.php constantsImplementing the wp-config.php hardening flow for salts, HTTPS, debugging, editing, and updates.

Common AI mistakes / anti-patterns

Mistake 1 — Leaving debug output on in production

php
// ❌ Insecure: errors rendered to visitors leak paths, SQL, secrets.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
php
// ✅ Secure: log privately, never display, in production.
define( 'WP_DEBUG', false );
// If you must debug on a live box, at least never display:
@ini_set( 'display_errors', '0' );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true ); // writes to wp-content/debug.log — block it from the web

Mistake 2 — Allowing the dashboard file editor

php
// ❌ Risky: compromised admin = arbitrary PHP via Appearance/Plugins editor.
// (default: editor enabled)
php
// ✅ Secure: disable file editing (and optionally all file mods).
define( 'DISALLOW_FILE_EDIT', true );
// Fully locked deploy (no plugin/theme install/update via UI):
define( 'DISALLOW_FILE_MODS', true );

Mistake 3 — 777 permissions "to make it work"

bash
# ❌ Insecure: world-writable lets any local process modify your site.
chmod -R 777 wp-content
bash
# ✅ Secure: least privilege.
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod 640 wp-config.php

Mistake 4 — Uploads directory that executes PHP

apache
# ❌ Insecure: a smuggled shell.php in uploads runs.
# (no restriction)
apache
# ✅ Secure: deny PHP execution in uploads (Apache). Place in wp-content/uploads/.htaccess
<FilesMatch "\.(?i:php|php\d|phtml|phar)$">
    Require all denied
</FilesMatch>

Mistake 5 — Default/duplicated security keys

php
// ❌ Insecure: placeholder salts (or copied between sites).
define( 'AUTH_KEY', 'put your unique phrase here' );
php
// ✅ Secure: generate unique values from the official salt API and rotate if leaked.
// https://api.wordpress.org/secret-key/1.1/salt/
define( 'AUTH_KEY', '...64 random chars...' );
// (all eight: AUTH_KEY/SALT, SECURE_AUTH_KEY/SALT, LOGGED_IN_KEY/SALT, NONCE_KEY/SALT)

Mistake 6 — Leaving XML-RPC enabled when unused

php
// ❌ Risky: XML-RPC is a brute-force and pingback amplification vector if not needed.
// (default: enabled)
php
// ✅ Secure: disable XML-RPC entirely if the site does not need it.
add_filter( 'xmlrpc_enabled', '__return_false' );
// Or block at the server level (see htaccess-hardening.conf).

Mistake 7 — Allowing REST user enumeration

bash
# ❌ Risky: /wp-json/wp/v2/users/ reveals usernames to unauthenticated visitors.
curl https://example.com/wp-json/wp/v2/users/
php
// ✅ Safer: require authentication for the users endpoint.
add_filter( 'rest_endpoints', function ( $endpoints ) {
    if ( isset( $endpoints['/wp/v2/users'] ) ) {
        $endpoints['/wp/v2/users'][0]['permission_callback'] = static function () {
            return is_user_logged_in();
        };
    }
    return $endpoints;
} );

Mistake 8 — Application Passwords enabled without review

Application Passwords (WordPress 5.6+) are powerful for integrations but create a long-lived credential surface. Disable them if unused, or restrict them to users who actually need machine access.

php
// ✅ Secure: disable Application Passwords if the site does not use them.
add_filter( 'wp_is_application_passwords_available', '__return_false' );

Related: see the secrets-credentials-management skill for storing and handling API keys and tokens safely. See the security-headers-csp skill for application-level security headers (HSTS belongs in this skill's server config; the rest is code-level), and the dependency-supply-chain-security skill for keeping bundled libraries and CDN assets from rotting.

Correct code examples

Hardened wp-config.php constants are in references/wp-config-hardening.php; Apache and nginx rules (deny PHP in uploads, protect wp-config.php/.htaccess/debug.log, limit xmlrpc.php) are in references/htaccess-hardening.conf; the consolidated pre-launch sweep is references/go-live-checklist.md.

Checklist

  • Unique, strong security keys/salts set (all eight).
  • DISALLOW_FILE_EDIT enabled in production.
  • FORCE_SSL_ADMIN enabled; site served over HTTPS.
  • WP_DEBUG/WP_DEBUG_DISPLAY off in production; logs not web-readable.
  • PHP execution denied in wp-content/uploads.
  • wp-config.php, .htaccess, debug.log, dotfiles not web-accessible.
  • Permissions least-privilege: dirs 755, files 644, wp-config.php 640/600.
  • XML-RPC disabled/limited if unused; user enumeration limited.
  • Core, plugins, themes kept updated; unused extensions removed.
  • Admin accounts use strong passwords + 2FA where possible.

Official references

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Wp Hardening Best Practices」では何ができますか?

WordPressサイトの設定やセキュリティ強化、wp-config.phpの編集、.htaccessやnginxルールの作成、ファイル権限の設定、デプロイ時のセキュリティに関する助言を行うときに使います。セキュリティキー、DISALLOW_FILE_EDIT、FORCE_SSL_ADMIN、デバッグ情報の出力無効化、uploads内でのPHP実行ブロック、機密ファイルの保護、最小権限に基づくファイル権限を扱います。サイトの設定時や見直し時には、先回りして適用してください。

TypingMindでWp Hardening Best Practicesを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Wp Hardening Best Practicesはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにWp Hardening Best Practicesをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/wpultimatesecurity/WordPress-Security-Skills/tree/dev/skills/wp-hardening-best-practicesを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Wp Hardening Best Practicesを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Wp Hardening Best Practicesで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもWp Hardening Best Practicesを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Wp Hardening Best Practices」は無料ですか?

はい。wpultimatesecurityがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇