ก่อนเริ่มเทคนิค WordPress JavaScript Malware Removal มาทำความเข้าใจ JavaScript และบทบาทในเว็บไซต์ WordPress
รู้ไหมว่า JavaScript เป็น web technology ที่ใช้โดย 94.5% ของเว็บไซต์ทั้งหมดบน World Wide Web? การปรับแต่ง animation และ responsiveness ในหน้าเว็บที่ทำให้ dynamic ทำได้ด้วย JavaScript ยังอนุญาตให้ developer ใช้ cross-platform runtime engines อย่าง Node.js เขียน server-side code ส่วนที่ดีคือ JavaScript รวมกับ HTML5 และ CSS3 ได้ seamless นำไปสู่การสร้าง webpages ดึงดูดสายตาที่ beneficial ต่อการโปรโมท business ออนไลน์
อย่างไรก็ตาม เนื่องจาก JavaScript จัดการข้อมูลจาก front-end ส่งไป server เพื่อ further processing มันอาจทำหน้าที่ man-in-the-middle โค้ด JavaScript ที่ harmless อาจถูกใช้ collect sensitive data Adversary อาจได้ sensitive data หรือ inject malware code เข้าเว็บไซต์ ทำให้ security breach เป็น information leakage
เนื่องจากบทความนี้เน้น WordPress websites ผมอยากส่องสว่างว่าจะใช้ JavaScript เป็น malware ใน WordPress website อย่างไร จะอภิปรายเทคนิค WordPress JavaScript Malware Removal ต่างๆ
บทความเกี่ยวข้อง – วิธีเช็ค WordPress หา malicious codes?
JavaScript ใช้เป็นอันตรายใน WordPress Website ได้อย่างไร?
ใน WordPress server side มี JavaScript files ที่ adversary เป้าหมายเพื่อ launch malware attacks ทำได้โดย compromise security ของ server สิ่งอันตรายของ WordPress JavaScript Malware คือ พวกมันสามารถทำงานเริ่มได้โดยไม่ต้องมี user interaction ขณะ browse WordPress website JavaScript (.js) files จำนวนมากถูก download เข้า browsing computer อัตโนมัติ ไฟล์เหล่านี้ถูก execute โดย browser เพื่อ view content, perform actions และ view online advertisements ไม่เช่นนั้น เว็บไซต์จะ detect mouse gestures และ actions บน webpage อย่างไร? ผ่านไฟล์เหล่านี้ที่ส่ง input จาก I/O devices ไป webpage เพื่อ further action
โดยทั่วไป web developers อาจเป็น ethical หรือ unethical จริงๆ cyber criminals บ่อยครั้งใช้ JavaScript code บนเว็บไซต์หลายแห่งทำให้มันทำงานเป็น malicious JavaScript function ดังนั้นหลัง attacker infect WordPress website ผ่าน JavaScript Malware malware files รอถูก download ไปที่ visitor's PC
ทันทีที่ innocent user เข้าชม infected website โค้ด JavaScript อันตรายจะถูก download อัตโนมัติใน PC ของ user การโจมตีแบบนี้เรียกว่า drive-by-attack ใน attack นี้ malware ที่ download อัตโนมัติใน PC ของ user จะ scan system vulnerabilities และได้ access เข้า PC ของ user ผ่าน vulnerabilities เหล่านั้น เมื่อได้ access มันจะ download files จากอินเทอร์เน็ตเข้า PC ของ user ด้วย administrative privileges และเริ่มทำลาย PC หรือส่งข้อมูลไปยังแฮกเกอร์ที่ remote monitor PC และ infect system เพิ่มเติม
บทความเกี่ยวข้อง – 25 Best WordPress Security Practices
วิธีระบุสาเหตุของ JavaScript Hack?
การรู้สาเหตุของ hack สำคัญมาก เพราะประหยัดเวลาและความพยายาม ใช้ correct technique ลบ malware ช่วย efficient removal จาก WordPress website และทำ browsing experience สำหรับ naive user ปลอดภัย นี่คือขั้นตอน enumerate causes ของ WordPress JavaScript Malware infection:
ตรวจสอบ backup หา JavaScript Malware files
JavaScript Malware files จะมีชื่อแปลกๆ ทำให้โดดเด่นใน WordPress install จะมี recently modified dates ด้วย เปิดไฟล์เหล่านี้ด้วย code editors อย่าง Dreamweaver, TextWrangler, BBEdit, Coda ฯลฯ คุณจะ identify ได้จาก color coding ของ website หรือ huge amount of code ว่า fishy หรือไม่
ค้นหา terms และ phrases บน search engine
หากคุณหา term ใดในโค้ดได้ เช่น element หรือ function name ที่ offbeat คุณสามารถ search บน Google หรือ DuckDuckGo และ analyze จาก search results ว่าไฟล์ติดเชื้อหรือไม่
ตรวจสอบ Raw Access Logs บน hosting cPanel
หากคุณระบุได้ว่าแฮกเกอร์找ไฟล์ไหน (ดู POST statements ใน log files) จะได้ hint ว่าอะไรถูก compromise จากนั้น reverse IP lookup อาจหา location ของแฮกเกอร์ได้
เช็ค plugins และ themes
บางครั้ง old plugins และ themes กลายเป็นเหตุผล security breach บน WordPress website Vulnerable areas อาจเป็น older versions ของ Gravity Forms, Revolution Slider, timthumb.php script ใน theme หรือ plugin ฯลฯ ต้อง update หรือ configure ให้ถูกต้องเพื่อ secure WordPress website
สแกน Database
อาจมี hidden admin users และ potentially hacked content อื่นๆ บน database ของ WordPress website ก่อน modify database แนะนำทำ secure และ clean backup ของ database ก่อน
ต้องความช่วยเหลือมืออาชีพใน WordPress JavaScript malware removal? ทิ้งข้อความที่นี่หรือแชทกับ Astra agent โดยตรง เราจะช่วยด้วยความยินดี ?
WordPress JavaScript Malware Removal Techniques
Malware ไม่ว่าจะเป็น JavaScript หรือภาษาอื่น harmful สำหรับ reputation ของเว็บไซต์ หาก search engine detect malware ใน website เว็บไซต์อาจโดน blacklist ทำให้ business เสียหายมาก หากอยากรู้ adverse effects ของ blacklisting อ่าน บทความนี้ บน Astra Security blog
ลบ JavaScript Malware จาก Themes
WordPress เก็บ JavaScript functions และ files ใน functions.php file ที่เพิ่มโดย WordPress theme function Functions คือ wp_enqueue_script และ wp_enqueue_style ตามลำดับ คุณลบ functions เหล่านี้จาก file เองได้โดยลบโค้ดเหล่านั้น แต่หาก WordPress website ใช้ child theme จะซับซ้อน เพราะต้องใช้ wp_dequeue_script และ wp_dequeue_style functions ในกรณีนี้ คุณต้อง include block โค้ดต่อไปนี้ใน functions.php ของ child theme:
<?php
add_action('wp_enqueue_scripts', 'remove_script_css');
function remove_script_css()
{
wp_dequeue_style( 'default-css' );
wp_dequeue_script( 'default-js' );
}
?>
Reinstalling of Plugins and Themes
เนื่องจาก WordPress ใช้ themes และ plugins เป็น building blocks แนะนำ re-install plugins จาก premium plugin developer อย่า install old plugins หรือ plugins ที่ไม่ได้ maintain Themes สามารถ re-install จาก fresh download หากมี modifications ทำไว้ reference จาก backup files และ replicate changes บน fresh copy ของ theme แนะนำอย่า upload old theme เพราะ hacked files อาจไม่ identifiable
Re-installing the WordPress
หาก 3 ขั้นตอนข้างต้นไม่ได้ผล ต้องทำ complete re-installation ของ WordPress แล้ว re-install themes และ plugins เพื่อลบ JavaScript Malware ใน WordPress website ทำได้ผ่าน one-click installer ใน web hosting control panel Backup ของ WordPress site ใช่ reference setup wp-config.php file บน new install เพื่อใช้ database credentials จาก former website จะ connect new WordPress installation กับ database version เดิม
สแกน PC
PCs ทั้งหมดที่ควบคุม WordPress website backend และ frontend ต้องสแกนด้วย proper antivirus และ malware detection tools ตามที่อภิปรายใน drive-by attack mechanism ว่า malicious JavaScript file download เข้า visitor's computer malware detector อาจ scan และ fish out malicious code ที่ใช้ inject WordPress website
ติดตั้งและรัน Security Plugins
หากคุณไม่สามารถ detect ได้ว่าอะไรผิดปกติใน WordPress JavaScript files แนะนำอย่า poke around เพิ่ม ใช้ security plugin audit website และเช็ค malicious JavaScript codes สามารถใช้ security plugins อย่าง Shield WordPress Security, Anti-Malware Security and Brute-Force Firewall ฯลฯ audit WordPress website และ define ways สำหรับ removal of malware จริงๆ Astra ยังเสนอ web firewall solutions ช่วยปกป้อง WordPress website จาก hosting malware code มี multiple security features ทำงาน efficiently ช่วยคุณ stay secure ในโลก competitive และ insecure นี้
Tracking POST request บน cPanel
หาก feature นี้ไม่เปิด ให้ enable ด้วย archiving feature ของ Access logs ใน cPanel ของ WordPress
สรุป
นี่คือ points สำหรับ WordPress JavaScript Malware Removal. Website administrators และ developers ต้องจดจำไว้เพื่อ secure WordPress websites จาก JavaScript Malware Administrator ควร ensure ว่า proper และ clean backup ถูก取得ก่อนลบหรืออัปเดต features ใดๆ ของ WordPress website Developers ต้อง follow secure coding principles หลีกเลี่ยง compromises ใน security Suspicious behaviour ต้อง report ทันทีให้ team of developers ผ่าน proper feedback system สุดท้าย team of developers ที่พัฒนา WordPress website ต้อง stay updated กับ best security practices และ latest JavaScript Malware