Post by Kromak » Wed Jan 08, 2020 7:25 pm

Hi all,

I am having a weird issue with my store that when I try to edit a product record and hit save it sends me to the "The page you requested cannot be found" page. It has been working fine since I created the site back in May last year and no files have been changed recently. I have a feeling it may have something to do with the SEO url's but I am getting the same issue when I try to turn them off ???

Any help is most appreciated.

Newbie

Posts

Joined
Thu Mar 08, 2018 9:04 pm

Post by ADD Creative » Wed Jan 08, 2020 8:40 pm

What version of OpenCart? What is the route part of URL that fails and of the one before you save? What redirects do you have in your htaccess?

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Kromak » Wed Jan 08, 2020 9:00 pm

Thanks for the reply.

I'm running 3.0.2.0 and I have just figured out there seams to be an issue with an image that is inserted at the bottom of the description that we use to show our product guarantee. Using code view at the bottom of the description we use:
<a href="https://www.mydomain.com/guarantee" target="_self"><img src="https://www.mydomain.com/image/catalog/ ... e.png"></a>

When I remove this code I can update as normal. This never used to happen before ???

Newbie

Posts

Joined
Thu Mar 08, 2018 9:04 pm

Post by straightlight » Wed Jan 08, 2020 9:11 pm

Possibly an .htaccess file configuration issue with the use of SEO or your config.php or admin/config.php file contains invalid paths.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by sw!tch » Thu Jan 09, 2020 11:48 am

Kromak wrote:
Wed Jan 08, 2020 9:00 pm
Thanks for the reply.

I'm running 3.0.2.0 and I have just figured out there seams to be an issue with an image that is inserted at the bottom of the description that we use to show our product guarantee. Using code view at the bottom of the description we use:
<a href="https://www.mydomain.com/guarantee" target="_self"><img src="https://www.mydomain.com/image/catalog/ ... e.png"></a>

When I remove this code I can update as normal. This never used to happen before ???
I bet this is related to mod_security if installed or mod_evasive. Check the server error logs, ask your web host if they are using mod_security..

The fact it happens when you throw in the linked image, makes me think it's probably triggering a false positive.. Try taking out target="_self", some OWASP rulesets (if used) are super sensitive.

Thats my guess.

Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by Kromak » Thu Jan 09, 2020 4:54 pm

sw!tch wrote:
Thu Jan 09, 2020 11:48 am
Kromak wrote:
Wed Jan 08, 2020 9:00 pm
Thanks for the reply.

I'm running 3.0.2.0 and I have just figured out there seams to be an issue with an image that is inserted at the bottom of the description that we use to show our product guarantee. Using code view at the bottom of the description we use:
<a href="https://www.mydomain.com/guarantee" target="_self"><img src="https://www.mydomain.com/image/catalog/ ... e.png"></a>

When I remove this code I can update as normal. This never used to happen before ???
I bet this is related to mod_security if installed or mod_evasive. Check the server error logs, ask your web host if they are using mod_security..

The fact it happens when you throw in the linked image, makes me think it's probably triggering a false positive.. Try taking out target="_self", some OWASP rulesets (if used) are super sensitive.

Thats my guess.
That was a fantastic guess! I can turn off modsecurity in cPanel and this issue goes away. There must have been an update which caused the bug. I have tried taking out the target="_self" command but I still get the issue with modsecurity enabled. Would there be a work around or would I need to contact my webhost to make some changes to the modsecurity config? Many thanks :)

Newbie

Posts

Joined
Thu Mar 08, 2018 9:04 pm

Post by sw!tch » Thu Jan 09, 2020 5:07 pm

Kromak wrote:
Thu Jan 09, 2020 4:54 pm
That was a fantastic guess! I can turn off modsecurity in cPanel and this issue goes away. There must have been an update which caused the bug. I have tried taking out the target="_self" command but I still get the issue with modsecurity enabled. Would there be a work around or would I need to contact my webhost to make some changes to the modsecurity config? Many thanks :)
If you can find the Mod Security Rule ID being flagged you can ask your host to disable it. I think you need root access to the Apache/ ModSec error log to locate the ID, but it might be somewhere in your cPanel as well. Every host is different to what they allow access to. Check under error logs in cPanel..

Personally - I would keep mod_security enabled if possible, ask your host to help track down the rule and just disable that. The issue is easily replicated on your end, they should be able to locate it without issue.

Edit :

Code: Select all

  src="https://www.mydomain.com/image/catalog/ ... e.png"></a>
is ...e.png the actual name of your image? If so that's probably what's triggering the rule. Make sure you have no special characters in the image name. A $_POST request with /... in front of an asset might look like a directory traversal attempt to mod_sec.

Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by paulfeakins » Thu Jan 09, 2020 6:41 pm

Kromak wrote:
Thu Jan 09, 2020 4:54 pm
I can turn off modsecurity in cPanel and this issue goes away.
I was going to suggest this too, it causes more issues than it solves in my experience.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by Kromak » Thu Jan 09, 2020 7:43 pm

Thanks for the help. I have now solved the issue.

After speaking to my webhost I have found out that they have recently switched from Comodo to OWASP rules for ModSecurity which was causing the bug. Specifically the rule "OWASP RULE 941160 NoScript InjectionChecker HTML injection" was not allowing the script in the product description and the server was trying to blacklist my ip. However, because my ip is whitelisted it was throwing up a 404 page.

Cheers everyone :)

Newbie

Posts

Joined
Thu Mar 08, 2018 9:04 pm

Post by padaliyajay » Tue Apr 25, 2023 1:28 pm

Don't turn off modsecurity. Use this rules to fix issues or ask hosting to add it
https://github.com/padaliyajay/modsecurity-opencart

Newbie

Posts

Joined
Thu Jul 20, 2017 5:37 pm

Post by kirkhall » Wed Apr 26, 2023 2:47 am

padaliyajay wrote:
Tue Apr 25, 2023 1:28 pm
Don't turn off modsecurity. Use this rules to fix issues or ask hosting to add it
https://github.com/padaliyajay/modsecurity-opencart
I had an issue recently where I could not add zones to a geo zone I was creating at System > Localisation > Geo Zones. I had to turn of mod-security in order to solve the issue. viewtopic.php?p=855588#p855588
Like I said turning off mod-security did solve the problem but it still seems extremely slow for that geo zone setup to load the page.
Would this be the fix I can have my host add to my server settings and be able to turn mod-security back on?

Active Member

Posts

Joined
Thu May 22, 2014 11:31 am

Post by straightlight » Wed Apr 26, 2023 5:15 am

kirkhall wrote:
Wed Apr 26, 2023 2:47 am
padaliyajay wrote:
Tue Apr 25, 2023 1:28 pm
Don't turn off modsecurity. Use this rules to fix issues or ask hosting to add it
https://github.com/padaliyajay/modsecurity-opencart
I had an issue recently where I could not add zones to a geo zone I was creating at System > Localisation > Geo Zones. I had to turn of mod-security in order to solve the issue. viewtopic.php?p=855588#p855588
Like I said turning off mod-security did solve the problem but it still seems extremely slow for that geo zone setup to load the page.
Would this be the fix I can have my host add to my server settings and be able to turn mod-security back on?
viewtopic.php?p=856405#p856409

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Amazon [Bot], Majestic-12 [Bot] and 37 guests