Decoded malware code [closed]

The malware stores an array of PHP fragments to execute at the bottom of its own file, delimited and encoded using the MD5 hash of the filename. It has a specific GUID to control it; on start up it checks all POST and cookie values for properly-encoded commands: PHP serialized arrays, XORed with both the … Read more

Sanitize user input fields before wp_insert_post

If calling, sanitize_text_field(), it actually call an internal function _sanitize_text_fields() and add a filter for override. So First look at _sanitize_text_fields(), which actually do Checks for invalid UTF-8, Converts single < characters to entities Strips all tags <——— including wp_strip_all_tags() here Removes line breaks, tabs, and extra whitespace Strips octets That’s mean if calling sanitize_text_field(), … Read more

malware undetectable by multiple scans

There are many ways to infect a site – and many ways to hide that infection from the ‘popular’ security plugins. One way to detect malicious code is via a file-hash-compare function. You may need to write your own though (I did, but it’s not perfect). That function would compare each file’s hash with a … Read more

How to protect a script execution on WordPress?

One approach (avoiding PHP timeouts) for a local Linux Cron Job (for exact timing) is creating a WP-CLI command (does not run in the browser), like: <?php /* Plugin Name: WP-CLI Foo */ function foo_command( $args ) { // Adjust to your needs … WP_CLI::success( $args[0] ); } WP_CLI::add_command( ‘foo’, ‘foo_command’ ); and the corresponding … Read more