wp-config.php 보안 취약점: 워드프레스 보안 강화
워드프레스 설치 후 반드시 확인해야 할 파일 중 하나가 바로 wp-config.php입니다.
이 파일은 데이터베이스 접속 정보와 보안 키 등이 포함된 핵심 설정 파일로, 외부에 노출되거나 잘못 설정될 경우 사이트 전체가 심각한 위협에 노출될 수 있습니다.
이번 페이지에서는 wp-config.php의 주요 보안 취약점과 이를 안전하게 보호하기 위한 점검 방법을 자세히 알아보겠습니다.
✅ wp-config.php 파일이란?
wp-config.php는 워드프레스의 핵심 설정 파일로, 사이트의 데이터베이스 접속 정보, 보안 키, 디버그 설정, 테이블 접두사 등의 중요한 정보가 담겨 있습니다.
워드프레스가 제대로 작동하기 위해 반드시 필요한 파일이며, 이 파일이 외부에 노출될 경우 데이터베이스 정보 유출, 관리자 권한 탈취, 워드프레스 내부 구조 파악, 보안 키를 이용한 세션 위조 등 심각한 보안 위협으로 이어질 수 있습니다.
워드프레스에서는 일반적으로 폴더는 755, 파일은 644 권한으로 설정합니다. 하지만 wp-config.php는 중요한 설정 정보가 포함된 파일이므로, 파일 권한을 600으로 설정해 소유자(testpilotweb)와 그룹(nobody)만 접근할 수 있도록 제한합니다.
600 권한으로 설정하면 외부 사용자나 다른 프로세스로부터의 접근을 차단할 수 있어 보안에 효과적입니다.
이러한 권한 설정은 서버에 직접 접근하여 변경하거나, 사용하는 호스팅 업체의 안내에 따라 FTP 또는 Cpanel을 통해 설정할 수 있습니다.
필요할 경우, 고객센터를 통해 권한 설정 방법에 대해 문의하는 것도 좋은 방법입니다.
✅ wp-config-sample.php
워드프레스 기본 설치 파일 중 하나인 wp-config-sample.php는 wp-config.php 파일의 예시 템플릿입니다.
워드프레스를 처음 설치할 때 이 샘플 파일을 복사하여 wp-config.php로 이름을 바꾸고, 데이터베이스 정보 등을 입력한 후 설치를 진행합니다.
일단 설치가 완료되면 wp-config-sample.php 파일은 필요하지 않으며, 보안상 삭제해도 무방합니다.
이 파일 자체에는 민감한 정보가 들어 있지 않지만, 공격자가 기본 경로를 통해 접근을 시도할 가능성을 줄이기 위해 제거하는 것이 좋습니다.
www]# cat wp-config-sample.php
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the installation.
* You don't have to use the website, you can copy this file to "wp-config.php"
* and fill in the values.
*
* This file contains the following configurations:
*
* * Database settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/
*
* @package WordPress
*/
// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** Database username */
define( 'DB_USER', 'username_here' );
/** Database password */
define( 'DB_PASSWORD', 'password_here' );
/** Database hostname */
define( 'DB_HOST', 'localhost' );
/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/**#@+
* Authentication unique keys and salts.
*
* Change these to different unique phrases! You can generate these using
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
*
* You can change these at any point in time to invalidate all existing cookies.
* This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );
/**#@-*/
/**
* WordPress database table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*
* At the installation time, database tables are created with the specified prefix.
* Changing this value after WordPress is installed will make your site think
* it has not been installed.
*
* @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#table-prefix
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/
*/
define( 'WP_DEBUG', false );
/* Add any custom values between this line and the "stop editing" line. */
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
콘텐츠 내 광고 및 제휴 링크가 포함될 수 있으며, 파트너스 활동으로 일정액의 수수료를 받을 수 있습니다.