Malware that reads files that do not originally exist and writes them to various folders with “$wp_update_file=” in WordPress is detected very often these days.

Process Flow of Malware

The process flow of this malware is very simple.

1 The file indicated by $wp_update_file= (this file does not exist in WordPress and is the body of the malware ) is read. The malware that is written to those files containing $wp_update_file= is a sub-malware for re-infection.

2 The read obfuscated file is de-obfuscated by base64_decode, and multiple malware codes are stored in an array by JSON decode.

3 Based on the data stored in the array, it alters and writes copies of itself in various parts of the files contained in WordPress. The malware itself may also be restored.

Which files are infected by this malware?

There is a wide range of files that this malware code can infect.
We have investigated the following files,
wp-config.php
wp-includes/vars.php
wp-includes/widgets.php
and other files that are executed each time a WordPress page is displayed.

This means that if even one piece of this code remains somewhere, when the page is displayed, the incorrect code will be re-written into the various WordPress files all at once.

How to get rid of malware

Since this malware is written to many WordPress files, it is very difficult to remove it by visually inspecting each file. It would be very difficult to remove them one by one.

If we first remove one of the malware files (located in the path indicated by $wp_update_file=), no matter how many times this malware is executed, the malware itself will not exist, making it non-toxic.

After that, removing the sub-malware for reinfection one by one, which contains $wp_update_file= (as shown in the above figure), is the most efficient and safe way.

This type of malware can be detected by
Free WordPress:Malware Scan & Security Plug-in [Malware and Virus Detection and Removal]
which can detect this type of malware.

Once you have eliminated the malware itself and sub-malware, you should also take basic security measures, such as plugging the zygosity that allowed hackers to alter the files on your server.