Skip to content
Back to Articles

The Plugin Folder You Can't See: Invisible Unicode Twins and an SVG That Runs JavaScript

Share:

The owner had done the sensible thing. Two administrator accounts they did not recognise had been demoted, the Plugins screen looked normal, and every plugin name on it was one they knew. The site kept injecting JavaScript anyway.

Two of those familiar plugins were not what they looked like. Their folder names were almost identical to the real ones: one used a hyphen that is not a hyphen, the other ended in a character that renders as nothing at all. On top of that, a footer widget carried a tiny invisible SVG that runs JavaScript without a single <script> tag. This article walks through both tricks and the read-only commands that expose them.

🔤 Twin #1: a hyphen that is not a hyphen

WordPress identifies a plugin by its folder and main file, for example shop-feed-sync/shop-feed-sync.php. The attacker uploaded a plugin ZIP whose folder looked exactly like a popular, legitimate plugin that was already a normal sight on online shops. (The names in this article are lab names; the real folders copied a well-known plugin.)

In a plain listing, the two folders below look like one name printed twice:

$ ls wp-content/plugins/
shop-feed-sync
shop‑feed‑sync
wholesale-pricing
wholesale-pricingㅤ

Ask the terminal to show the raw bytes and the difference appears immediately:

$ ls wp-content/plugins/ | LC_ALL=C cat -v
shop-feed-sync
shopM-bM-^@M-^QfeedM-bM-^@M-^Qsync
wholesale-pricing
wholesale-pricingM-cM-^EM-$

The second name uses U+2011 NON-BREAKING HYPHEN (bytes E2 80 91) instead of the ASCII hyphen - (byte 2D). It renders the same in the dashboard, in most terminals and in most file managers.

Why bother? Because a different folder name means a different plugin as far as WordPress is concerned:

  • The update checker never matches it to the official directory, so a routine "update all" never overwrites the malicious copy.
  • Reinstalling the genuine plugin creates a second folder next to it and leaves the fake one alone.
  • Anyone who greps for the real slug finds the real plugin and stops looking.

The disguise went further than the folder. The Plugin Name: header mixed Greek omicron (ο), Cyrillic е and Cyrillic с into the familiar name. On screen it reads correctly. A search for the name in the Plugins screen, typed with a normal keyboard, returns nothing. (Look-alike ASCII file names, such as a capital I in place of a lowercase l, are a related trick covered in this earlier article; here the look-alikes are Unicode characters.)

Inside, the folder was a full copy of the legitimate plugin: about 4,700 files and 42 MB of vendor libraries, which is a lot of clean code for a scanner or a human to wade through. The malicious part was small: a 1.7 KB main file and one extra 2 KB loader in src/ that no official release contains. The loader required a third file that was empty when we found it, a slot that could be refilled later.

👻 Twin #2: a name that ends in nothing

The second fake folder ended in U+3164 HANGUL FILLER (bytes E3 85 A4). It is a valid letter in file names, it is not whitespace, so most trimming logic keeps it, and most fonts draw it as empty space. The folder looked like an ordinary wholesale-pricing plugin.

This one was a trojanized copy rather than a clone with extras. A single line in the main file had changed: the call that starts the plugin's licensing SDK was replaced with an include_once of a file in inc/ that the real plugin does not ship. Everything else matched upstream, so a quick visual diff of the first screen of code would show nothing wrong.

The timestamps were forged as well. The folder's modification time was set about twenty hours before the moment the folder was actually created. Filesystems that record a birth time (ext4, XFS) give that away:

stat -c '%n | birth %w | mtime %y' wp-content/plugins/*/

A birth time later than the modification time means the mtime was set by hand (touch -d or an archive that preserved fake dates).

📜 The upload left a fingerprint in the access log

Both plugins were installed the normal way, through Plugins → Add New → Upload in a logged-in administrator session. The activation request contains the folder name, and the browser percent-encodes the non-ASCII bytes:

"POST /wp-admin/update.php?action=upload-plugin HTTP/1.1" 200
"GET /wp-admin/plugins.php?action=activate&plugin=shop%E2%80%91feed%E2%80%91sync%2Fshop-feed-sync.php&_wpnonce=… HTTP/1.1"

Legitimate plugin slugs are ASCII. A plugin= parameter containing %E2%80%91, %E3%85%A4 or any other multi-byte sequence is a strong signal on its own.

The same session also planted an auto-login backdoor in a code-snippets plugin, a familiar pattern. The new part was the next trick.

🎞️ An SVG that runs JavaScript without a script tag

A footer widget (a "Custom HTML" block stored in the widget_block option) contained this, shortened here:

<svg width="0" height="0" style="position:absolute;display:none" xmlns="http://www.w3.org/2000/svg">
<defs>
<switch id="…" style="DA5MmZhWydDb250ZW50LVR5cGUn…" tabindex="3"></switch>
<g id="…" class="const n=e.currentScript;if(e.querySelector(…" tabindex="0" data-x="…"></g>
<!-- more elements, each holding one fragment, each with a tabindex -->
<animate attributeName="opacity" dur="1s" onbegin="
let s='', p=[...this.parentNode.children]
.filter(t => t.hasAttribute('tabindex'))
.sort((t, e) => t.tabIndex - e.tabIndex);
p.forEach(t => { for (let e of t.attributes)
if (!['id','tabindex'].includes(e.name) && !e.name.startsWith('data-') && !e.name.startsWith('on'))
{ s += e.value; break } });
eval(s); this.parentNode.parentNode.remove();" />
</defs>
</svg>

Step by step:

  1. Zero-size and hidden. Nothing is drawn, so nobody sees a broken image.
  2. The payload is split across attributes of several harmless-looking elements (style, class and so on). None of them looks like code on its own; several look like random base64.
  3. tabindex is the ordering key. The fragments sit in the markup in a shuffled order, so even reading them top to bottom gives garbage.
  4. <animate onbegin> is the trigger. onbegin is an SVG animation event. It fires on its own when the animation timeline starts, with no click and no <script> element anywhere.
  5. The handler sorts the fragments, joins the first eligible attribute of each, runs the result with eval(), and then removes the whole SVG from the page so DevTools shows nothing afterwards.

Filters and quick searches that look for <script, onload= or onerror= miss this completely. The only tell-tale words are onbegin and eval, and they sit in an attribute of an animation element.

🔗 What the decoded stage does

Joined in the right order, the fragments form an obfuscated script with a few deliberate guards:

  • Hides from logged-in users. If the page contains the admin bar stylesheet (#admin-bar-inline-css), it removes itself and does nothing. The owner, browsing the site while logged in, never triggers it.
  • Runs once per page through a global flag.
  • Waits for the checkout. It only continues when the page contains a payment section or a form labelled "Checkout".
  • Fetches the next stage from a smart contract. It sends a JSON-RPC eth_call to public blockchain RPC endpoints, asking contract 0x83f3CB2F941773e97069cB0BBAa9028A843f5Be1 for its stored data, decodes the answer and runs it.

That last step is the "blockchain as a dead drop" technique: the attacker can change the code served to every infected site with one transaction, and there is no server to take down. The same loader also appeared a second time, as an obfuscated <script> in a checkout page builder's "external scripts" setting. Payment pages were clearly the target. More on the blockchain side in this earlier write-up.

🔎 Read-only checks (run these first)

1. Folders with non-ASCII names in plugins, themes and mu-plugins:

cd /path/to/site/wp-content
LC_ALL=C find plugins themes mu-plugins -mindepth 1 -maxdepth 1 -name '*[! -~]*' 2>/dev/null

2. Name the hidden characters so you know exactly what you are looking at:

python3 -c '
import os, sys, unicodedata
for n in sorted(os.listdir(sys.argv[1])):
    odd = sorted({"U+%04X %s" % (ord(c), unicodedata.name(c, "?")) for c in n if ord(c) > 126})
    if odd: print(repr(n), "->", ", ".join(odd))
' /path/to/site/wp-content/plugins
'shop‑feed‑sync' -> U+2011 NON-BREAKING HYPHEN
'wholesale-pricingㅤ' -> U+3164 HANGUL FILLER

3. Active plugins with multi-byte characters. If the byte length and the character length differ, something non-ASCII is in there:

SELECT option_value
FROM wp_options
WHERE option_name = 'active_plugins'
AND LENGTH(option_value) <> CHAR_LENGTH(option_value);

4. Plugin headers with look-alike letters:

find /path/to/site/wp-content/plugins -maxdepth 2 -name '*.php' \
-exec grep -lP '^[\s*]*Plugin Name:.*[^\x00-\x7F]' {} + 2>/dev/null

5. Activations and uploads in the access log:

grep -E 'plugin=[^& ]*%(C[2-9A-F]|D[0-9A-F]|E[0-9A-F])' /path/to/access.log*
grep -E 'action=upload-plugin|action=upload-theme' /path/to/access.log*

6. Forged timestamps (birth after modification):

for d in /path/to/site/wp-content/plugins/*/; do
stat -c '%W %Y %n' "$d"
done | awk '$1 > 0 && $1 > $2 + 3600 {print "birth after mtime:", $3}'

7. SVG animation events in the database (widgets, posts, theme and plugin settings):

SELECT option_id, option_name, CHAR_LENGTH(option_value) AS len
FROM wp_options
WHERE option_value REGEXP 'onbegin|onrepeat|onend=|<animate|eth_call'
AND option_name NOT LIKE '%transient%';

SELECT ID, post_type, post_status
FROM wp_posts
WHERE post_content REGEXP 'onbegin|<animate|eth_call';

8. Look at the page the way a customer does. Log out (or use a private window), open the checkout page, and search the page source for onbegin, eth_call and eval(. Remember that the loader deletes itself from the live DOM, so search the source, not the Elements panel.

🧹 Cleanup without losing anything

  1. Back up first. Take a full database dump and copy the suspicious folders somewhere outside the web root before you change anything.
  2. Deactivate the fakes. In the Plugins screen they look like the real thing, so check the folder path in the deactivate link (hover it and look for %E2%80%91 or similar) before you click.
  3. Delete by inode, not by typing the name. You cannot reliably type an invisible character, and a wrong guess can hit the genuine plugin:
    ls -i /path/to/site/wp-content/plugins/
    # check the inode number twice, then:
    find /path/to/site/wp-content/plugins -maxdepth 1 -inum 1234567 -exec rm -rf {} +
  4. Remove the loader from the database: the widget block (and its entry in sidebars_widgets) and any page-builder "custom/external script" field that carries the same code. Edit serialized options through WordPress itself, not with a raw text replace, or you will break the stored lengths.
  5. Purge every cache layer: object cache, page cache, CDN. A cached checkout page can keep serving the loader after the database is clean.
  6. Review every administrator account, application passwords and active sessions. These plugins were uploaded from a real admin session; demoting accounts is not enough if their sessions and app passwords still work.

🧪 Indicators and quick checklist

  • Plugin or theme folders containing U+2011 (E2 80 91), U+3164 (E3 85 A4) or any other non-ASCII character
  • Plugin Name: headers mixing Greek or Cyrillic letters into a familiar name
  • A full copy of a popular plugin with one or two extra files that no official release contains
  • A trojanized plugin where the licensing SDK call is replaced by an include_once
  • Folder birth time later than its modification time
  • Access-log activations with percent-encoded multi-byte bytes in plugin=
  • Hidden 0×0 <svg> with <animate onbegin="…eval(…)"> and tabindex-ordered fragments
  • Scripts that skip pages containing #admin-bar-inline-css and wait for a checkout form
  • JSON-RPC eth_call to contract 0x83f3CB2F941773e97069cB0BBAa9028A843f5Be1

❓ FAQ

How can two WordPress plugin folders have the same name?

They don't. One uses ordinary ASCII characters and the other swaps in a Unicode character that looks the same, such as a non-breaking hyphen, or adds an invisible one at the end. To the filesystem and to WordPress they are two different plugins; to a human they look identical.

Will updating or reinstalling the real plugin remove the fake one?

No. The update and install process works on the genuine folder name. The look-alike folder is never matched to the official plugin, so it is never overwritten or updated, and it stays active.

How can an SVG image run JavaScript?

Inline SVG supports event attributes. onbegin on an <animate> element fires automatically when the animation starts, so code in that attribute runs without a click and without any <script> tag. This only works when the SVG is part of the page markup, for example inside a custom HTML widget; an SVG loaded through <img> cannot run scripts.

Why didn't the site owner see anything when testing the site?

The loader checks for the admin bar and quits for logged-in users, only activates on checkout pages, and deletes its own SVG after running. Test logged out, on the checkout page, and read the page source rather than the live DOM.