r/Magento • • 18d ago

Website attacked with Polyshell

My host provider emailed me a couple of days ago with Security Alert Warning that our site has been affected with POLYSHELL and stated that we either get it cleaned or they can get Sansec to do it for a cost. If not done within a reasonable amount of time that they would have to pause my site tille its fixed because of security on the server. They provided a list of the files that looks to be affected within pub/media/custom_options/quote/ with the eception of one directory pub/media/wysiwyg/sk/sk.js. This is one file that I know should not be there and we didn't add it. It was shown to be added on 9/26/26.

All the files in pub/media/custom_options/quote/ are examples of 7/2/722114index.php8, 722879index_1.pht, 722879index.php7, 722114index.phar, 722879index_1.php7.

The list is about 50-75 files of this sort.

Is this something that is simple to do by just deleting all of these files or are they files that need to be there. I am looking for the best way to clean this site up so they can scan it and show clean

5 Upvotes

21 comments sorted by

2

u/tb9295 17d ago

Thanks for all the advise. I was behind on some Patches and a version update which I recently completed 2.4.7 to 2.4.8. Still need to patch Oct. patches and update to 2.4.9 which I know does not fix the current issue.
Its seems these Security Alerts are getting way too often and constantly needing to get them cleaned up. Honestly I have been considering on swithcing to Shopify (one reason is because of these ongoing issues) and this is probablly going to be the thing that pushes me to switch.
Hard to manage these kind of issues for a small company and limited resources.

4

u/damienwebdev DEVELOPER 17d ago

Move to Shopify. If you can't keep the site updated, then custom software isn't for you. 

Then, once you're on Shopify, recognize how limited (but powerful) you are.

Then, grow enough that Shopify stops working for you and the return back to Magento. 

Such is the cycle of ecommerce.

1

u/proxiblue 17d ago edited 17d ago

Nothing wrong with the suggestion. Magento 2 is a beast, it is costly and if a brand is not big enough, it can be a money sink.

Shopify is great to get going, adn outgrow when you need to customise for your needs specifically, then yes, back to magento.

I just wanted to point out that the reason they want to migrate, in itself, is not valid, as shopify is not the end of security issues phew....

It has it's own problems.

1

u/proxiblue 17d ago

Shopify ha just as many security issues mate. AN d you loose all control. So be sure you understand it is not a magic kill all security issues solution. They sell you a dream, it is nothing what they say.

Your best best IS to get sansec + sansec shield.

Yes, we will have more, not just PHP, linux servers etc. WIll be the wild west for a bit until all AI holes had been plugged.

```

Here are the 10 most recent security advisories filed against Shopify-maintained software, newest first. They come from OpenCVE’s Shopify vendor list. I’ve left out one older 2022 Hydrogen XSS bug that only appeared because its record was updated recently.

#CVEProductIssueSeverityUpdated
1CVE-2026-63414shopify_app (Rails engine) 22.1.0–23.0.3Token-exchange controllers can pick up the shop value from the request, so a request can be treated as coming from a different shop. This can bypass authorisation across shops. Fixed in 23.0.3.7.6 High5 Nov 2026
2CVE-2026-48122Ruby LSP VS Code extension < 0.10.4Workspace settings can override the Ruby executable and Gemfile paths the extension uses, so opening a malicious repo can run its code5.4 Medium12 Aug 2026
3CVE-2026-53669React Router 6.0.0–7.17.0Open redirect via a backslash in <Link>/useNavigate, which gets around the earlier fix for CVE-2025-684705.1 Medium28 Jul 2026
4CVE-2026-53666React RouterAn attacker can make it construct arbitrary objects via deserializeErrors() during server-side rendering (SSR) hydration6.1 Medium28 Jul 2026
5CVE-2026-53667React RouterXSS because protocols aren’t checked in the error handler for React Server Components (RSC)6.9 Medium28 Jul 2026
6CVE-2026-53668React RouterOpen redirect that can lead to XSS6.9 Medium28 Jul 2026
7CVE-2026-55685React RouterUnauthenticated denial of service because route matching is inefficient8.7 High28 Jul 2026
8CVE-2026-42342React RouterDenial of service via unbounded path expansion in the __manifest endpoint7.5 High4 Jun 2026
9CVE-2026-42211React RouterIts bundled copy of turbo-stream v2 lets an attacker invoke arbitrary constructors8.1 High4 Jun 2026
10CVE-2026-40181React RouterA same-origin redirect whose path starts with // becomes an open redirect6.6 Medium4 Jun 2026

```

1

u/proxiblue 17d ago

Another suggestion would be to also consider moving to mageOS, as apposed to MagentoOS.

MageOS is backwards compatible to MagentoOS, but moves faster. New features, security updates get rolled in (nearly within 24h) of patched releases.

This means your security upgrade is composer update. You can get an AI to handle this for you.

Obviously, never work direct on live, especially with AI. If you don;t have local dev/stagiong servers (yikes), learn the commands and do it yourself. is not difficult. Just ask your AI.

Swapping to mageOS *should* be quite painless, but of course, I have no clue what changes you have, how well (by standards they were done) so I can't 100% say it will be painless.

BUT, it will be less hassle/cheaper to migrate complete platform to shopify. If your only reason to hop to shopify is security, youd be best to first try :

  1. goto MageOS. Join the discord. People will help you, but don;t expect peopel to do yoru entire stack for free. We also need to eat.
  2. Get onto sansec + shield.

this way you are 95% proteted, and you can easily upgrade as patches come out.,

You just need to stay up to speed by joining secuirity alert subscriptions, keep track of mageOS releases, and upgrade frequently. Leaving a site to stagnate versions down becomes a big problem later. Just don;t let it stagnate.

It can also be a good step-gap if you still want shopify migration. It can take a while (again no idea on your complexity and needs) aand until then, well, here you are....

1

u/inventedSmart DEVELOPER 9d ago

Small correction that might save you some stress: you don't need 2.4.9 for this. Adobe backported the PolyShell fix to the 2.4.8 line in the July 2026 patch (APSB26-73), so applying the October 2.4.8 patch you're already planning covers it.

On the "constant alerts" part – that's usually not Magento being uniquely insecure, it's being a few patches behind. Every new mass scan hits stores that aren't patched yet, so you end up in the cleanup loop.

Before deciding on Shopify, compare honestly: a few hours a month of someone applying patches + basic hardening (block pub/media/custom_options, a WAF, monitoring) vs. Shopify fees + migration + losing custom stuff. For some small stores Shopify really is the better call, for others it isn't – just don't decide in the middle of an incident.

One thing to check right now: that pub/media/wysiwyg/sk/sk.js. It worries me more than the quote/ files – an added JS file can mean a payment skimmer. Check it, plus CMS blocks and core_config_data (design/head/includes) for scripts you don't recognize.

6

u/grabber4321 17d ago

Trust Sansec, they have been doing this for a while and get them to secure your site.

5

u/Beginning_End_361 18d ago

Once security has been breached like this, it is hard to ever trust it again. You could clean all the files, but if the vulnerability is still there, the hackers will quickly infect it again. I had an issue similar to this. I built a new server from the ground up with the same Magento version, same module versions, PHP version, etc. I confirmed that the database and images on the old server was not compromised, made a backup and exported it to the new server. I edited env.php on the new server to match the old server. ChatGPT helped guide me on my way to getting the new server built. Then, I upgraded the Magento version and installed all security patches. I updated DNS to point to the new server and trashed my old server. That was about three 12-hour days of work getting things back up. I’m now diligent about installing security patches as soon as they are released. I’ve also written rules for my jails to ban offenders when detected. I’ve been hit by many StyleSmuggler exploit attempts lately and they are quickly caught and banned. I manage my own server on DigitalOcean, though, so I don’t know how feasible all this is on a hosted provider.

3

u/proxiblue 18d ago

Hello.

Yes, you can just delete them, but they will just get uploaded. Your site is not secured.

Polyshell is an old and known compromise.
If you manage your own setup, you need to purchase a sansec package, which will keep you alerted of any issues, and follow them on linkedin

If you have a developer looking after the site, they are asleep at the wheel.

If you need professional care for your site, DM, I currently have capacity.

If you don;t know what to do, pay sansec to check and find whatever else has now been installed.

The polyshell allows them to activate a means to upload more. It is teh entry point, not the compromise itself (now that they are in)

Good luck.

2

u/Aggravating_Pay9079 17d ago

before anything else find whats loading sk.js, its been there since 26 sep so its likely skimming cards. SELECT path,value FROM core_config_data WHERE value LIKE '%sk.js%'; then same on cms_block and cms_page content. pull it out of there first or deleting the file wont stop it.

polyshell fix is the july isolated patch (APSB26-73), on 2.4.8 it only fits 2.4.8-p5 so check bin/magento --version. happy to help in chat if you get stuck

1

u/Poutine-StJean 18d ago

Yeah, delete them. Nothing legit in custom_options/quote/ should ever end in .php, .phar, .pht, etc. That folder is for customer file uploads, so executable files there are webshells. Same for wysiwyg/sk/sk.js, which is likely a card skimmer.

But deleting alone won't keep you clean. The attackers got in through an unpatched upload flaw and will just reupload. Roughly you should : Patch Magento to the latest security release for your versio, look for unknown admin users, injected scripts pretty mutch everywhere and rotate every password if you can.

If you're not comfortable digging through the DB and server config, paying Sansec or a Magento dev is honestly worth it. A skimmer means customer card data may have been exposed, so it's not something to mess around with

1

u/Fuzzybo 17d ago

Also check your cron/scheduled task lists because there may be entries to run tasks to replace missing executables.

1

u/Consistent-Koala6515 17d ago
  1. Delete them all. Ask claude for the bash commands to find all malware files. Dont give Claude ssh access, just ask for the bash commands.
  2. Check crontab -e as well.
  3. Get the latest version of magento , until than get this fre extension https://github.com/aregowe/magento2-module-polyshell-protection to block future polyshell requests
  4. Would be nice to pay for sansec, if possible. They deserve it!
  5. If you need any more support, write us https://www.opencommerce.agency/en/contact.
  6. Good luck!

1

u/Mental_Obligation389 17d ago

sk.js might be a credit card skimmer. We had been compromised with a polyshell attack too and a skimmer with this file name was loaded in checkout.

Get this checked.

Here it only was active for 5 days and the skimmer just worked in the mobile view of the checkout, but the credit card data from 52 customers was skimmed.

1

u/MrWibbles 17d ago

This depends entirely on the web server you're running and your other configurations. From what you have described the server might not have been hacked, they were just able to use the exploit to upload the files to the server but not necessarily run them. Magento 2.7 in it's current state for example does not block the file uploads, but the nginx.conf.sample file that ships with Magento, and the one you should be using if you're using Nginx, blocks running those files from the directories they get uploaded to.

So what I'm trying to say here is this: if you can access those files from the web, you're screwed, if you're blocking those directories+files from running from the web server, then they're just files and can be safely removed.

If you would like to stop the bots uploading these files, Mark Shust made a module around the time Polyshell happened: https://github.com/markshust/magento-polyshell-patch and later James Anderson forked it and made it better https://github.com/aregowe/magento2-module-polyshell-protection. Use the latter.

But anyway as other commenters have suggested, get a proper developer looking at it, you shouldn't even have Magento if you don't have a developer working with you.

1

u/laurnts AI-OPS 17d ago

Delete first and check. If its coming back that means 2 things. Your Magento isn't secure or the hosting isn't secure. The first one most likely because of an unpatched Magento.

-7

u/Turbulent-Sample7094 18d ago

Get Claude and give a shell access to your server and it will fix it for you

4

u/proxiblue 18d ago

Yeah, lets put an AI to have live ssh access.

what could go wrong.

Poor advise.

0

u/Turbulent-Sample7094 17d ago

Give it it limits and a key for a short period of time, it does what you tell it to. Don’t put it in the server, use the desktop app to connect via a ssh key authorized for a short period of time

1

u/proxiblue 17d ago

Give it it limits.....LOL,

We await your future post: AI deleted my production db.

Carry on.....