Crypto Exchange Script Security: 11 Steps Before Launch
Crypto exchange script security: 2FA, admin panel only from your IPs, no plugin installs, integrity checks, Cloudflare-only server, payment detail checks.
On this page
The main risk for an online exchanger running on an off-the-shelf script isn't being knocked offline — it's quietly swapped payment details: the site works, orders keep coming in, and for a week your customers pay a fraudster. After these steps, the admin panel opens only from your addresses, a stolen admin password can't be used to install a malicious plugin, you get a Telegram message about every login and every new administrator, and you notice a change in payment details within 5 minutes.
Plan
| Step | What we do | Time |
|---|---|---|
| 1 | Build a list of components and versions | 15 min |
| 2 | Clean up accounts and enable 2FA | 20 min |
| 3 | Open the admin panel only from your IPs | 15 min |
| 4 | Block plugin installs and file edits from the admin panel | 5 min |
| 5 | Update WordPress and plugins and verify their integrity | 30 min |
| 6 | Lock down the server: key-only SSH, no extra ports or panels | 20 min |
| 7 | Let only Cloudflare reach the server | 15 min |
| 8 | Enable HTTPS and security headers | 10 min |
| 9 | Set up alerts for logins, new administrators and plugins | 20 min |
| 10 | Check payment details every 5 minutes | 30 min |
| 11 | Set up backups and test from the outside | 40 min |
What real breaches have shown
- Compromised plugins in the official directory (Wordfence, June 2024): through developer accounts, attackers injected code into five plugins from the WordPress.org directory that created a new administrator and sent its credentials to the attackers. Sites received the malicious code through a regular update.
- Mass campaigns against vulnerable plugins: a vulnerability in a popular plugin is exploited automatically on every site at once; the first thing the attacker does is create their own administrator and install a backdoor plugin.
- Swapped payment details — the reason exchangers specifically get hacked: access to the admin panel or the database lets an attacker replace the wallet address or card number customers pay to.
What follows from this:
- The attacker creates their own administrator → an alert for every new user and every admin role assignment (step 9).
- A backdoor plugin is installed through the admin panel → plugin installs and file edits from the admin panel are blocked (step 4).
- Malicious code arrives with an update → after every update, check files against checksums and review the administrator list (step 5).
- The admin password is stolen by an infostealer → 2FA for everyone and the admin panel only from your IPs (steps 2–3).
- Plugin vulnerabilities are exploited right after disclosure → a list of components with versions and alerts about new vulnerabilities (steps 1, 5).
- Cracked "free" (nulled) versions of paid plugins come with a backdoor → official sources only (step 5).
- The site is behind Cloudflare, but the server answers directly → the protection is bypassed; the server accepts only Cloudflare (step 7).
- phpMyAdmin and password-based SSH are reachable from the internet → closed (step 6).
- Swapped payment details are noticed through customer complaints → automatic checks every 5 minutes (step 10).
- Nothing to restore from after a breach → off-server backups and a tested restore (step 11).
Step 1. Build a list of components and versions
Why: you can't update or check what you don't know you have.
How — on the server, from the site folder, with WP-CLI (installation — wp-cli.org):
cd /var/www/<site>
wp core version
wp plugin list --fields=name,status,version,update
wp theme list --fields=name,status,version,update
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered
php -v; nginx -v
Save the output to a file — this is your baseline. Feed the components and versions into a vulnerability tracking system: that is what we build Perimeter for — you add the list and get an alert when a known vulnerability is published for one of the components.
Done when: the list of components with versions is saved and tracked.
Step 2. Clean up accounts and enable 2FA
How.
- From the administrator list (step 1), delete everyone you can't name: test accounts, "demo", the account of the developer who installed the script:
wp user delete <ID> --reassign=<owner_ID>
- Give staff operators a role with no access to settings or payment details. In Premium Exchanger this is the User Roles section: each permission in a role is switched on and off individually — leave operators order processing and remove currency and reserve management, plugin management, general settings, user management and the ability to disable 2FA. Keep one or two administrators.
- Two-factor authentication for everyone who can log in to the admin panel: a 2FA plugin from the official directory (authenticator app or hardware key). Make 2FA mandatory for the administrator role.
- Administrator passwords — 16+ characters, from a password manager.
Check: log out and log back in — a code is requested after the password.
Done when: there are no more than two administrators, all with 2FA.
Step 3. Open the admin panel only from your IPs
Why: a stolen password is useless if the login page won't open from someone else's network.
How — with a Cloudflare rule (if the site is behind Cloudflare; this way the visitor's IP is seen correctly):
- Cloudflare → your domain → Security → WAF → Custom rules → Create rule.
- Expression (Edit expression):
(http.request.uri.path eq "/wp-login.php" or starts_with(http.request.uri.path, "/wp-admin"))
and not http.request.uri.path eq "/wp-admin/admin-ajax.php"
and not ip.src in {203.0.113.10 198.51.100.0/24}
- Action — Block.
admin-ajax.php is excluded on purpose: the site's forms work through it, and without the exclusion orders will break. 203.0.113.10 is the office's external IP, 198.51.100.0/24 is your VPN network; replace them with your own. If the script has its own admin panel address, add it to the expression.
If the site is not behind Cloudflare, do the same in Nginx:
location = /wp-login.php { allow 203.0.113.10; deny all; include snippets/php.conf; }
location ^~ /wp-admin/ {
location = /wp-admin/admin-ajax.php { allow all; include snippets/php.conf; }
allow 203.0.113.10; deny all;
location ~ \.php$ { include snippets/php.conf; }
}
snippets/php.conf is your existing block that passes PHP to php-fpm.
Check: on mobile data, open https://<site>/wp-login.php — error 403; from the office — the login page. Placing an order on the site over mobile data works.
Done when: the admin panel opens only from your addresses, and orders work from anywhere.
Step 4. Block plugin installs and file edits from the admin panel
Why: even if someone gets into the admin panel, they can't install a backdoor plugin or inject code into the theme.
How. In wp-config.php, above the line /* That's all, stop editing! */:
define('DISALLOW_FILE_EDIT', true); // no theme and plugin editor
define('DISALLOW_FILE_MODS', true); // no plugin installs or updates from the admin panel
Updates are now done only through WP-CLI on the server (step 5). File permissions: the owner is your user, PHP gets read-only access, except for wp-content/uploads:
sudo chown -R deploy:www-data /var/www/<site>
sudo find /var/www/<site> -type d -exec chmod 750 {} \; -o -type f -exec chmod 640 {} \;
sudo chmod -R 770 /var/www/<site>/wp-content/uploads
deploy is the user you work as over SSH. If the exchanger script needs write access to other folders (cache, logs), grant it selectively. The Premium Exchanger installation instructions ask you to check write permissions for certain files and folders but don't list them, and set 644 on the license files: find out which folders the script writes to from the developer or from errors in the PHP log after tightening permissions.
And block PHP execution in the uploads folder (Nginx):
location ~* ^/wp-content/uploads/.*\.php$ { deny all; }
Check: the Plugins → Add New menu item and the file editor are gone from the admin panel; https://<site>/wp-content/uploads/test.php returns 403.
Done when: you can't install a plugin or change a file from the admin panel.
Step 5. Update WordPress and plugins and verify their integrity
How.
wp core update && wp plugin update --all && wp theme update --all
wp core verify-checksums # WordPress files match the official ones
wp plugin verify-checksums --all # for plugins from the WordPress.org directory
wp plugin list --status=inactive # inactive ones — delete
wp plugin delete <plugin>
wp user list --role=administrator --fields=ID,user_login,user_registered
verify-checksumslists files that differ from the official ones — investigate before launch.- Delete inactive plugins and themes: an inactive plugin stays on the server and can still be vulnerable.
- Plugins and the script — only from the WordPress.org directory or from the script developer. A "free" version of a paid plugin from a forum — no.
- After every update, review the administrator list again: has a new one appeared?
verify-checksums won't check paid plugins or the exchanger script itself: keep a copy of the original archive from the developer and compare:
diff -rq /var/www/<site>/wp-content/plugins/<script> /srv/originals/<script>-<version>/
Done when: everything is updated, checksum verification shows no mismatches, and nothing unused is left.
Step 6. Lock down the server: key-only SSH, no extra ports or panels
How.
- SSH — key-only, no root. File
/etc/ssh/sshd_config.d/10-hardening.conf:
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
sudo sshd -t && sudo systemctl reload ssh
Before doing this, make sure key-based login works — otherwise you'll lock yourself out.
- What the server is listening on:
sudo ss -tlnp
Only 22, 80 and 443 should face the outside. MySQL — on 127.0.0.1:3306, not on 0.0.0.0.
- phpMyAdmin, Adminer, hosting panels — remove them or open them only from your IP.
- Automatic security updates:
sudo apt install unattended-upgrades && sudo dpkg-reconfigure -plow unattended-upgrades.
Done when: password login is rejected, only 22/80/443 are open to the outside, and no panels are reachable from the internet.
Step 7. Let only Cloudflare reach the server
Why: if the server answers directly on its own IP, the rule from step 3 and Cloudflare's protection are bypassed.
How (ufw):
sudo ufw default deny incoming
sudo ufw allow from <your_IP> to any port 22 proto tcp
for ip in $(curl -s https://www.cloudflare.com/ips-v4) $(curl -s https://www.cloudflare.com/ips-v6); do
sudo ufw allow proto tcp from "$ip" to any port 80,443
done
sudo ufw status numbered # delete old "80/443 from anywhere" rules: sudo ufw delete <number>
sudo ufw enable
Cloudflare's address list changes rarely, but it does change — repeat this every quarter.
To see the visitor's IP rather than Cloudflare's in the logs and in the step 9 alerts, add to Nginx:
# one set_real_ip_from line for each range from cloudflare.com/ips
set_real_ip_from 173.245.48.0/20;
real_ip_header CF-Connecting-IP;
Check — from mobile data:
curl -sk -m 10 -o /dev/null -w "%{http_code}\n" https://<server_IP>/ -H "Host: <site>"
Expected result — a timeout (000). Through the domain, the site opens.
Done when: the server doesn't answer on its IP but works through Cloudflare.
Step 8. Enable HTTPS and security headers
How.
- Cloudflare → SSL/TLS: Full (strict) mode, with a certificate on the server (Cloudflare Origin Certificate or Let's Encrypt). Edge Certificates → Always Use HTTPS — on.
- Headers in the Nginx
serverblock:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Content-Security-Policy "frame-ancestors 'self'" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
frame-ancestors prevents your site from being embedded in someone else's page with fake buttons laid over it.
Check: curl -sI https://<site> | grep -iE "strict|nosniff|frame-ancestors" — all three lines.
Done when: HTTP redirects to HTTPS and the headers are in place.
Step 9. Alerts for logins, new administrators and plugins
How.
- Set up a bot for alerts, as in step 8 of the article Where to store USDT. In
wp-config.php:
define('OBM_BOT', '<bot_token>');
define('OBM_CHAT', '<owner_chat_id>');
- File
wp-content/mu-plugins/obm-alerts.php(must-use plugins always run and can't be deactivated from the admin panel):
<?php
function obm_alert($text) {
$ip = $_SERVER['REMOTE_ADDR'] ?? 'cli';
wp_remote_post('https://api.telegram.org/bot' . OBM_BOT . '/sendMessage', [
'body' => ['chat_id' => OBM_CHAT, 'text' => $text . ' | ' . home_url() . ' | IP ' . $ip],
]);
}
add_action('wp_login', fn($login) => obm_alert("Admin login: $login"));
add_action('user_register', fn($id) => obm_alert('New user: ' . get_userdata($id)->user_login));
add_action('set_user_role', function ($id, $role) {
if ($role === 'administrator') obm_alert('Administrator role granted: ' . get_userdata($id)->user_login);
}, 10, 2);
add_action('activated_plugin', fn($p) => obm_alert("Plugin activated: $p"));
add_action('switch_theme', fn($name) => obm_alert("Theme switched: $name"));
Check: log in to the admin panel — you get an "Admin login" message with your IP; create a test user and delete it — you get "New user".
Done when: every test action produces a Telegram message within a minute.
Step 10. Check payment details every 5 minutes
Why: to learn about a swap within 5 minutes rather than from customers.
How.
- The baseline is a file
/etc/obm/requisites.txtwith the allowed payment details, one per line (wallet addresses, card numbers). The file is owned by root, so it can't be changed through the site's admin panel. - The script
/usr/local/bin/obm-check.shchecks both the page and the database:
#!/bin/bash
BOT="<bot_token>"; CHAT="<chat_id>"; SITE="https://<site>"
alert() { curl -s -X POST "https://api.telegram.org/bot$BOT/sendMessage" -d chat_id="$CHAT" --data-urlencode text="$1" >/dev/null; }
# 1. payment page: every TRON address on it must be in the baseline
for addr in $(curl -s "$SITE/<payment_details_page>" | grep -oE '\bT[1-9A-HJ-NP-Za-km-z]{33}\b' | sort -u); do
grep -qx "$addr" /etc/obm/requisites.txt || alert "PAYMENT DETAILS: address on the site is not in the baseline: $addr"
done
# 2. database: the fingerprint of the payment details table has not changed
NOW=$(cd /var/www/<site> && sudo -u deploy wp db query "SELECT * FROM <payment_details_table>" --skip-column-names | sha256sum | cut -d' ' -f1)
OLD=$(cat /var/lib/obm/requisites.sha256 2>/dev/null)
[ "$NOW" != "$OLD" ] && alert "PAYMENT DETAILS: database table changed" && echo "$NOW" > /var/lib/obm/requisites.sha256
<payment_details_table> is the table where the exchanger script stores each currency's payment details. Its name depends on the script and version; in Premium Exchanger, database tables use the pr_ prefix (as stated in its installation instructions). You can find the right one by searching the database dump for one of your addresses: wp db export - | grep -n "<your_address>". The regular expression looks for TRON addresses; add your own patterns for cards and other networks.
- Run every 5 minutes:
sudo mkdir -p /var/lib/obm && sudo chmod 700 /usr/local/bin/obm-check.sh
echo "*/5 * * * * root /usr/local/bin/obm-check.sh" | sudo tee /etc/cron.d/obm-check
- Legitimate change of payment details: first the owner edits
/etc/obm/requisites.txt, then the payment details in the admin panel. The table alert will arrive in this case too — it confirms the change was made by you.
Check: on a test copy of the site, change an address in the admin panel to one not in the baseline — both messages arrive within 5 minutes.
Done when: the swap on the test copy is detected within 5 minutes.
Step 11. Backups and an external check
How.
- Back up the database and files every night — not to the same server:
D=$(date +%F)
cd /var/www/<site> && sudo -u deploy wp db export /tmp/db-$D.sql
tar czf /tmp/site-$D.tgz -C /var/www <site> /tmp/db-$D.sql
rclone copy /tmp/site-$D.tgz backup:obmen/ && rm /tmp/db-$D.sql /tmp/site-$D.tgz
For details on storing and encrypting backups, see the article "Backups".
- Once before launch and once a quarter — restore from a backup to a test server: the site opens and orders can be created.
- Final external check — from mobile data:
| Check | Expected |
|---|---|
https://<site>/wp-login.php |
403 |
curl to the server IP (step 7) |
timeout |
nmap -Pn -p 22,80,443,3306,8080,8443 <server_IP> |
22 — only from your IP; everything else filtered |
https://<site>/wp-content/uploads/test.php |
403 |
| Headers (step 8) | in place |
| Placing an order | works |
Done when: a backup has been restored to the test server and every row in the table matches.
Checklist
| # | What to check | How to confirm | ☐ |
|---|---|---|---|
| 1.1 | Component baseline saved | there is a file with the output of the step 1 commands, dated no earlier than the last update | ☐ |
| 1.2 | Components are tracked for vulnerabilities | the tracking system lists WordPress, every plugin, the theme, PHP and Nginx — with the same versions as in the baseline | ☐ |
| 2.1 | One or two administrators, all known | wp user list --role=administrator — one or two rows, and you can name the person behind each login |
☐ |
| 2.2 | Operators have no access to payment details or plugins | log in as an operator — there are no currency and reserve, plugin, settings or user sections in the menu | ☐ |
| 2.3 | 2FA is mandatory | log out and log in as each administrator — a code is requested after the password; in the 2FA plugin settings the administrator role is set to "required" | ☐ |
| 3.1 | Admin panel closed to other addresses | from mobile data, https://<site>/wp-login.php and /wp-admin/ — error 403 |
☐ |
| 3.2 | Admin panel opens from the office and VPN | from the office and over VPN — the login page | ☐ |
| 3.3 | Orders work from anywhere | place a test order over mobile data — it gets created | ☐ |
| 4.1 | Plugins can't be installed and files can't be edited from the admin panel | the menu has no Plugins → Add New and no theme or plugin file editor | ☐ |
| 4.2 | PHP doesn't run in uploads | https://<site>/wp-content/uploads/test.php — 403 |
☐ |
| 4.3 | PHP can't overwrite the site's code | sudo -u www-data touch /var/www/<site>/index.php (use your PHP user) — "Permission denied" |
☐ |
| 5.1 | Everything is updated | wp core check-update — "WordPress is at the latest version"; in wp plugin list the update column is none everywhere |
☐ |
| 5.2 | WordPress files and directory plugins match the official ones | wp core verify-checksums and wp plugin verify-checksums --all — no warnings about mismatched or extra files |
☐ |
| 5.3 | The exchanger script matches the developer's archive | diff -rq from step 5 — empty output |
☐ |
| 5.4 | No inactive plugins or themes | wp plugin list --status=inactive and wp theme list --status=inactive — empty (except one fallback theme, if you need it) |
☐ |
| 6.1 | Password and root logins are rejected | ssh -o PubkeyAuthentication=no <user>@<IP> — "Permission denied (publickey)"; ssh root@<IP> — refused |
☐ |
| 6.2 | The database doesn't listen on an external address | sudo ss -tlnp | grep 3306 — only 127.0.0.1:3306 |
☐ |
| 6.3 | No control panels on the internet | https://<site>/phpmyadmin/ and /adminer.php — 403 or 404 from mobile data |
☐ |
| 6.4 | Security updates install automatically | systemctl is-enabled unattended-upgrades — enabled |
☐ |
| 7.1 | The server doesn't answer on its IP | curl to the IP from the step 7 check, over mobile data — 000 |
☐ |
| 7.2 | 80/443 open only to Cloudflare | sudo ufw status — only Cloudflare ranges for ports 80 and 443, no Anywhere rows |
☐ |
| 7.3 | The log shows the real visitor IP | open the site from a phone and find the request in the Nginx access.log — it shows the phone's IP, not a Cloudflare address |
☐ |
| 8.1 | Encryption to the server with certificate validation | Cloudflare → SSL/TLS — Full (strict) mode | ☐ |
| 8.2 | HTTP redirects to HTTPS | curl -sI http://<site> — code 301 and Location: https://… |
☐ |
| 8.3 | Security headers in place | the step 8 check command prints three lines | ☐ |
| 9.1 | The alert module can't be deactivated from the admin panel | wp-content/mu-plugins/obm-alerts.php is in place; the admin panel lists it under Must-Use plugins |
☐ |
| 9.2 | An admin login triggers a message with the IP | log in — within a minute you get "Admin login" with your IP, not a Cloudflare address | ☐ |
| 9.3 | A new user triggers a message | create and delete a test user — you get "New user" | ☐ |
| 10.1 | The payment details baseline can't be changed through the site | ls -l /etc/obm/requisites.txt — owner root; the contents match the payment details in the admin panel |
☐ |
| 10.2 | The check runs every 5 minutes | grep obm-check /var/log/syslog | tail — runs every 5 minutes |
☐ |
| 10.3 | A swap is detected | on a test copy of the site, changing an address in the admin panel triggers both messages within 5 minutes | ☐ |
| 11.1 | The nightly backup is stored off the server | rclone ls backup:obmen/ — there is yesterday's archive |
☐ |
| 11.2 | Restore has been tested | a record of a restore to the test server, no older than a quarter: the site opened, an order was created | ☐ |
| 11.3 | The external check matched | every row of the step 11 table, tested from mobile data, gave the expected result | ☐ |
For exchangers in Georgia
- VASP registration document on the website: the National Bank of Georgia (NBG) draft amendments (October 2025) proposed displaying it in all channels, including the website and the app. Check whether the amendment has been adopted; posting it in advance costs nothing.
- Online orders are the same transactions for the NBG log: every amount paid out goes into the log (see the article AML log under the NBG order).
When you need a pentest
The steps above fix configuration mistakes. They don't find vulnerabilities in the logic of the exchanger itself: whether the amount or rate in an order can be changed, whether other people's orders can be viewed, whether payment details can be swapped through a form, whether limits can be bypassed. That is checked manually — with a pentest before launch and after major changes.
Questions
The script is rented together with the server — which of this is on me?
Check the contract for what the provider handles: updates, backups, server protection. Steps 2, 3, 9 and 10 almost always remain your responsibility.
Is Cloudflare enough?
It protects against DDoS and some web attacks, but not against a stolen admin password or payment details swapped through the admin panel — that's what steps 2–4, 9 and 10 are for.
Can I install a "free" (nulled) version of the script or a paid plugin?
No. Cracked versions of paid plugins come with a backdoor, and there's nothing to check them against: you don't have the original archive to compare with (step 5). The script and plugins — only from the developer or the WordPress.org directory.
My exchanger script isn't on WordPress. Does this article apply?
Steps 3, 6–8, 10 and 11 don't depend on the platform. For steps 2, 4, 5 and 9, find the equivalents in your platform: mandatory 2FA, a block on uploading code from the admin panel, comparing files with the developer's original archive, and alerts about logins and new administrators.
Will regular shared hosting do?
Not for an exchanger: on shared hosting you don't control the firewall or SSH, so steps 6 and 7 can't be done. You need a VPS or a dedicated server where you set the access rules.
How do I get into the admin panel from home or while traveling?
Through the VPN whose network is in the step 3 rule: connect to the VPN and the admin panel opens. Don't add a home or hotel IP to the rule "temporarily": such exceptions get forgotten and never removed.
I got a login alert, but it wasn't me. What should I do?
Immediately change that user's password, reset their 2FA and end all their sessions: wp user session destroy <login> --all. Then check the administrator list, plugins and checksums (step 5) and the payment details on the site (step 10); save the IP from the alert for the investigation.
How can I tell the site has already been hacked?
Signs: an unfamiliar login in the administrator list, verify-checksums shows modified files, the plugin folders or mu-plugins contain things you didn't install, an address not in the baseline has appeared on the payment page. If even one sign is present, stop accepting orders, save a copy of the server for investigation and restore from a verified backup (step 11), changing all passwords and keys.
Why does Cloudflare need Full (strict) mode rather than Flexible?
In Flexible mode Cloudflare connects to your server over HTTP: on the leg to the server, order data travels unencrypted. Full (strict) encrypts that leg as well and validates the server's certificate (step 8).
How often should I update WordPress, plugins and the script?
Security updates — as soon as they're released: plugin vulnerabilities are exploited automatically soon after disclosure. After every update, verify checksums and the administrator list (step 5); test updates to the exchanger script itself on a test copy first.
Sources
- WordPress — Hardening WordPress
- Wordfence — Supply Chain Attack on WordPress.org Plugins Leads to 5 Maliciously Compromised WordPress Plugins (June 2024)
- Cloudflare — IP ranges
- WP-CLI — wp core verify-checksums, wp plugin verify-checksums
- NBG — draft amendments to the VASP registration rules (28.10.2025): registration document on the website and in the app
- Premium Exchanger — User Roles (documentation)
- Premium Exchanger — Script Installation Instructions
- Cloudflare — SSL/TLS encryption mode Flexible (HTTP connection to the origin server)
- WP-CLI — wp user session destroy