Beginner sessionSesi pemula

WordPress Under the HoodIsi "Dapur" WordPress

A friendly tour of the core files and database tables, and why knowing them helps you find malware. We'll use a restaurant to keep it easy to remember.

Tur santai ke core files dan tabel database, plus kenapa memahaminya membantu kamu menemukan malware. Kita pakai analogi restoran biar gampang diingat.

7 core files7 core files Database tablesTabel database Malware clean-up scenarioSkenario malware clean-up 8-question quizKuis 8 soal

Use the arrow keys or the buttons below to move through the slides.Pakai tombol panah keyboard atau tombol di bawah buat pindah slide.

The big pictureGambaran besar

WordPress = Files + DatabaseWordPress = Files + Database

Every WordPress site is built from two parts that work together: files that hold the code, and a database that holds your content and settings.

Setiap situs WordPress terdiri dari dua bagian yang kerja bareng: files yang berisi kode, dan database yang menyimpan konten serta settings kamu.

Part 1Bagian 1
Files
The instructions: how to connect, how to load pages, how to log in. Examples: wp-config.php, index.php.
Instruksinya: gimana cara connect, load halaman, dan login. Contoh: wp-config.php, index.php.
Part 2Bagian 2
Database
The storage: posts, pages, users, comments and settings. Organised into tables like wp_posts and wp_users.
Penyimpanannya: posts, pages, users, comments, dan settings. Dirapikan dalam tabel seperti wp_posts dan wp_users.
Restaurant analogy: the files are the building, the kitchen equipment and the house rules. The database is the pantry, the recipe book and the guest list. You need both to serve a meal.
Analogi restoran: files itu gedung, peralatan dapur, dan aturan restorannya. Database itu gudang bahan, buku resep, dan daftar tamu. Dua-duanya dibutuhkan biar bisa menyajikan makanan.

Good to know: database tables usually start with wp_. That prefix is set in wp-config.php and can be different on some sites. Perlu tahu: tabel database biasanya diawali wp_. Prefix ini diatur di wp-config.php dan bisa beda di beberapa situs.

Core filesCore files

The 7 core files7 core files penting

Four files run in a chain on every visit. Three more handle settings rules, logins and scheduled chores.

Empat file jalan berantai di setiap kunjungan. Tiga lainnya ngurus aturan server, login, dan tugas terjadwal.

index.php→ wp-load.php→ wp-config.php→ wp-settings.php→ Page appearsHalaman muncul
index.php
The front door. First file to run on a visit. It starts the loading process.
Pintu depan. File pertama yang jalan saat ada kunjungan. Dia memulai proses loading.
Host who greets guestsHost yang menyambut tamu
wp-load.php
Finds wp-config.php and uses it to connect to the database.
Mencari wp-config.php dan memakainya buat connect ke database.
Grabs the keys, unlocks the kitchenAmbil kunci, buka dapur
wp-config.php
Site settings: DB login (DB_NAME, DB_USER, DB_PASSWORD, DB_HOST), security keys, table prefix, debug switches.
Settings situs: login DB (DB_NAME, DB_USER, DB_PASSWORD, DB_HOST), security keys, table prefix, saklar debug.
Key ring and safe combinationGantungan kunci dan kombinasi brankas
wp-settings.php
Sets up the basic tools, then loads your active plugins and theme.
Menyiapkan tools dasar, lalu me-load plugins dan theme yang aktif.
Crew setting up stationsKru menyiapkan station
.htaccess
Hidden Apache file (starts with a dot). Pretty links (/about-us), redirects and security rules.
File Apache tersembunyi (diawali titik). Link rapi (/about-us), redirects, dan aturan keamanan.
House rules and signsAturan restoran dan papan petunjuk
wp-login.php
Creates the login, registration and password reset pages.
Bikin halaman login, registrasi, dan reset password.
Staff entrance with a security checkPintu staf dengan pengecekan keamanan
wp-cron.php
Runs background jobs, like publishing scheduled posts or checking for updates.
Menjalankan tugas background, misalnya publish scheduled post atau cek update.
Alarm clock and to-do listAlarm dan to-do list
Restaurant analogy: a guest walks in (index.php), someone unlocks the kitchen (wp-load.php with the keys from wp-config.php), the crew sets up (wp-settings.php), and the meal is served.
Analogi restoran: tamu masuk (index.php), seseorang buka dapur (wp-load.php pakai kunci dari wp-config.php), kru bersiap (wp-settings.php), lalu makanan disajikan.

Tip: always back up wp-config.php and .htaccess before editing. One typo can break the whole site.Tip: selalu backup wp-config.php dan .htaccess sebelum diedit. Satu typo bisa bikin seluruh situs rusak.

Database · Part 1Database · Bagian 1

Settings and peopleSettings dan orang-orangnya

Two tables answer two questions: "How is this site set up?" (wp_options) and "Who has an account?" (wp_users).

Dua tabel ini menjawab dua pertanyaan: "Situs ini di-setting gimana?" (wp_options) dan "Siapa saja yang punya akun?" (wp_users).

wp_options
Site-wide settings: URL, admin email, active theme and plugins, widgets. Each has a unique option_name and an option_value.
Settings seluruh situs: URL, email admin, theme dan plugins aktif, widgets. Tiap setting punya option_name unik dan option_value.
siteurlhomeblognameadmin_emailtemplateactive_plugins
autoload: yes means WordPress loads it on every page. Too many large ones can slow your site.
autoload: yes artinya WordPress me-load option itu di setiap halaman. Terlalu banyak yang besar bisa bikin situs lambat.
wp_users
Everyone registered on the site, from administrators to subscribers.
Semua orang yang terdaftar di situs, dari administrator sampai subscriber.
IDuser_loginuser_passuser_emaildisplay_name
user_pass: stored hashed (scrambled). Nobody can read the real password.
user_pass: disimpan hashed (diacak). Nggak ada yang bisa baca password aslinya.
Extra user details (roles, permissions) live in wp_usermeta.
Detail tambahan user (roles, permissions) ada di wp_usermeta.
Restaurant analogy: wp_options is the settings board in the office (name, address, opening hours). wp_users is the staff and guest list.
Analogi restoran: wp_options itu papan settings di kantor (nama, alamat, jam buka). wp_users itu daftar staf dan tamu.
Database · Part 2Database · Bagian 2

wp_posts and the supporting castwp_posts dan tabel pendukung

Despite the name, wp_posts holds almost every kind of content. A column called post_type tells them apart.

Walau namanya begitu, wp_posts menyimpan hampir semua jenis konten. Kolom post_type yang membedakannya.

post · blog postblog post page · static pagehalaman statis attachment · media filefile media revision · older versionversi lama nav_menu_item · menu itemitem menu product · plugin types, e.g. WooCommercetipe dari plugin, mis. WooCommerce

Columns to know: post_title, post_content, post_status, post_name, post_author, post_parent. Don't use guid as a real link, because it can change.Kolom penting: post_title, post_content, post_status, post_name, post_author, post_parent. Jangan pakai guid sebagai link asli, karena bisa berubah.

Other tablesTabel lainnyaWhat they storeIsinya
wp_comments, wp_commentmetaComments (author, content, status) and plugin extras like ratingsComments (author, isi, status) dan tambahan plugin seperti ratings
wp_terms, wp_term_taxonomy, wp_term_relationships, wp_termmetaCategories and tags: the names, their type, which posts they apply to, and extra detailsCategories dan tags: namanya, jenisnya, post mana yang memakainya, dan detail tambahan
wp_postmetaExtra data for posts and pages: custom fields, SEO titles, layout settingsData tambahan untuk posts dan pages: custom fields, SEO title, layout settings
wp_linksOld "Blogroll" feature, mostly unused todayFitur lama "Blogroll", sekarang hampir nggak dipakai
Restaurant analogy: wp_posts is one big filing cabinet with menus, flyers, photos and old drafts, and post_type is the label on each folder. The meta tables are sticky notes with extra details.
Analogi restoran: wp_posts itu satu lemari arsip besar berisi menu, brosur, foto, dan draft lama, dan post_type itu label di tiap map. Tabel meta itu sticky notes berisi detail tambahan.
Malware scenario · Part 1Skenario malware · Bagian 1

Why file structure helps you find malwareKenapa paham file structure membantu cari malware

Redirects, spam, pop-ups and defacement all have to run from somewhere. If you know where each file sits in the loading chain, you know where to look first.

Redirects, spam, pop-ups, dan defacement pasti jalan dari suatu tempat. Kalau kamu tahu posisi tiap file di rantai loading, kamu tahu harus cek di mana dulu.

Look for injected or obfuscated code and unexpected redirect rules. Check in this order. Tap each one as you go.Cari injected atau obfuscated code dan redirect rules yang nggak wajar. Cek sesuai urutan ini. Tap satu-satu saat kamu cek.

1. index.phpThe entry point that runs on every visit, so injected code here fires on every page.
1. index.phpEntry point yang jalan di setiap kunjungan, jadi kode injeksi di sini aktif di semua halaman.
2. .htaccessServer rules. Look for unexpected redirect rules sending visitors to unknown domains.
2. .htaccessAturan server. Cari redirect rules yang nggak wajar dan mengarahkan pengunjung ke domain asing.
3. .js filesRedirects and pop-ups are often injected into JavaScript.
3. File .jsRedirects dan pop-ups sering diselipkan ke JavaScript.
4. Active theme: /wp-content/themes/[active-theme]/Loaded on every page, so site-wide pop-ups, redirects and defacement often live here.
4. Theme aktif: /wp-content/themes/[active-theme]/Di-load di setiap halaman, jadi pop-ups, redirects, dan defacement di seluruh situs sering ada di sini.
5. .html / .htm filesOnly if one specific static page redirects, was replaced, or a phishing/spam page appeared.
5. File .html / .htmHanya kalau satu halaman statis tertentu redirect, diganti, atau muncul halaman phishing/spam.
Checked: Sudah dicek: 0 / 5
Restaurant analogy: a vandal could swap the sign on the front door (index.php), rewrite the house rules so guests get sent to a rival restaurant (.htaccess), or slip flyers into every menu (theme and .js). You inspect the places every guest passes first.
Analogi restoran: pelaku bisa mengganti papan di pintu depan (index.php), menulis ulang aturan restoran supaya tamu diarahkan ke restoran saingan (.htaccess), atau menyelipkan brosur ke semua menu (theme dan .js). Kamu periksa tempat yang dilewati semua tamu dulu.
✗ Files look cleanFiles kelihatan bersih
The symptom continues anyway. Don't stop here.
Tapi gejalanya masih ada. Jangan berhenti di sini.
✓ Next stepLangkah berikutnya
Check the database. For WordPress, the customer can also scan it with Wordfence or MalCare.
Cek database. Untuk WordPress, customer juga bisa scan database pakai Wordfence atau MalCare.
Malware scenario · Part 2Skenario malware · Bagian 2

Confirm database malwareKonfirmasi malware di database

When the files don't explain the symptom, start from the symptom and go straight to the table that matches it.

Kalau files nggak menjelaskan gejalanya, mulai dari gejala lalu langsung ke tabel yang cocok.

SymptomGejalaStart atMulai dariStrong evidence looks likeBukti kuat berupa
Spam pages on Google, injected spamSpam pages di Google, spam contentwp_posts
(post_title, post_content)(post_title, post_content)
Spam posts the customer never created. Record post IDs and URLsSpam posts yang nggak pernah dibuat customer. Catat post ID dan URL
Redirect to an unknown domainRedirect ke domain asingwp_options
(siteurl, home, theme options)(siteurl, home, theme options)
The same malicious domain as in the redirect. Record option name and valueDomain berbahaya yang sama dengan redirect-nya. Catat option name dan value
JavaScript in posts or pagesJavaScript di posts atau pageswp_posts → wp_postmetaUnexpected external URLs or scripts tied to the infected post. Record post ID and valueURL eksternal atau script yang nggak wajar dan terkait post yang kena. Catat post ID dan value
Unknown administratorAdministrator asingwp_users, wp_usermetaUnrecognized admin, unexpected email or unexplained elevated privileges, confirmed unauthorized by the customerAdmin asing, email aneh, atau privileges naik tanpa alasan, dan customer konfirmasi itu tidak sah
Malware returns after cleanupMalware muncul lagi setelah cleanupAll of the aboveSemua di atasAlso run the persistence checks in the Reinfection page, step 4Jalankan juga persistence checks di halaman Reinfection, step 4

How to open it: Websites → Dashboard → Databases → Management (or phpMyAdmin) → pick the affected website's database → Enter phpMyAdmin. Check the table prefix first.Cara bukanya: Websites → Dashboard → Databases → Management (atau phpMyAdmin) → pilih database website yang terdampak → Enter phpMyAdmin. Cek table prefix dulu.

✗ Don't jump to conclusionsJangan buru-buru menyimpulkan
Calling a long encoded or serialized value "malware", or assuming an unfamiliar username is proof.
Menyebut value panjang yang encoded atau serialized sebagai "malware", atau mengira username asing itu bukti.
✓ Compare and confirmBandingkan dan konfirmasi
Compare with the real site and installed plugins. Ask the customer to confirm accounts. A script that matches a plugin is legitimate.
Bandingkan dengan situs asli dan plugins yang terpasang. Minta customer konfirmasi akun. Script yang cocok dengan plugin itu sah.
Restaurant analogy: a redirect is like the address on the settings board (wp_options) being changed. Spam pages are flyers slipped into the filing cabinet (wp_posts). An unknown admin is a stranger added to the staff list (wp_users).
Analogi restoran: redirect itu seperti alamat di papan settings (wp_options) yang diganti. Spam pages itu brosur yang diselipkan ke lemari arsip (wp_posts). Admin asing itu orang asing yang ditambahkan ke daftar staf (wp_users).
Malware scenario · Part 3Skenario malware · Bagian 3

Classify, then clean upKlasifikasi dulu, baru clean up

Label every finding before you act. The label decides what you do next.

Kasih label ke setiap temuan sebelum bertindak. Label itu menentukan langkah berikutnya.

ClassKelasExampleContohWhat to doYang dilakukan
Strong evidenceBukti kuatSpam posts the customer didn't create; a redirect in wp_optionsSpam posts yang bukan dibuat customer; redirect di wp_optionsRecord the detailsCatat detailnya
Potential compromisePotensi compromiseUnknown admin with administrator rightsAdmin asing dengan hak administratorConfirm with the customerKonfirmasi ke customer
InconclusiveBelum meyakinkanA long encoded value in plugin settingsValue panjang yang encoded di plugin settingsDon't call it malware without more evidenceJangan sebut malware tanpa bukti tambahan
UnresolvedBelum terselesaikanScanner is clean, symptom continuesScanner bersih, gejala masih adaKeep investigating database and filesLanjut investigasi database dan files

If the customer confirms an admin is unauthorized, send a KoPilot action to demote or delete the user. Warn them first that deleting a user also deletes its posts. Removing the user alone is not a cleanup, so keep investigating.Kalau customer konfirmasi admin itu tidak sah, kirim KoPilot action untuk demote atau delete user. Kasih tahu dulu bahwa menghapus user juga menghapus post-nya. Menghapus user saja bukan cleanup, jadi lanjut investigasi.

Before you remove anything (tap each one)Sebelum menghapus apa pun (tap satu-satu)
Every finding is classified: strong, potential, inconclusive or unresolved.
Setiap temuan sudah diklasifikasi: strong, potential, inconclusive, atau unresolved.
A current backup of files and database exists (create one if not).
Ada backup terbaru untuk files dan database (buat kalau belum ada).
Findings shared with the customer: table, record IDs/URLs, option name and value.
Temuan sudah dibagikan ke customer: tabel, record ID/URL, option name dan value.
I have the customer's permission to remove the records (or restore).
Saya sudah dapat izin customer untuk menghapus records (atau restore).
Ready: Siap: 0 / 4
Restaurant analogy: before you throw anything out, photograph the mess, keep a copy of the recipe book, and ask the owner. Then clean.
Analogi restoran: sebelum membuang apa pun, foto dulu kekacauannya, simpan salinan buku resep, dan tanya pemiliknya. Baru bersih-bersih.

Internal wiki pages: Database malware · Close-out · ReinfectionHalaman internal wiki: Database malware · Close-out · Reinfection

QuizKuis

Check what you learnedCek yang sudah kamu pelajari