Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


martyyn

1971 posts

Uber Geek
+1 received by user: 772

ID Verified

#196270 25-May-2016 11:58
Send private message

I have a handful of small websites on a shared host in the US. I have a dedicated IP for the small group and pay for extra cpu, ram, I/O, etc.

 

One of the sites has a couple of php pages allowing simple interaction with an mysql db and they recently had an issue where they would get random 403 errors when entering text. I tracked it down to modsec rules not allowing the word 'casino' (and a whole host of other words) to be used in text fields. Casino is a valid word for them to use so I need to find a solution.

 

Although the site is far from mission critical and the db holds nothing but basic information I still want it to be secure. The hosts have suggested we just turn it off for now as I cant even make updates to the PHP in the plugin (same 403 error which again suggests modsec issues according to the plugin support forum), but what are my options going forward ?

 

It's a Wordpress site with Wordfence doing all the usual stuff. I'll sign it up for basic Cloudflare shortly, but in terms of the PHP the pages are handled by a WordPress plugin called shortcode-exec-php and the db interaction is all in php files checking the user is logged in before running anything. There is basic checking of the data entered by the users before the forms are posted (make sure fields aren't empty and numbers are numbers, that sort of thing) and the code itself uses mysql_real_escape_string on the $_POST variables and $wpdb->blah statements.

 

My understanding is that should handle any attemped SQL-injection and XSS issues, but I'm happy to be told I'm wrong.

 

From what I've found this morning about Wordpress and modsec it seems like most people either spend the time to work out which rules break which files and exclude them, or they just turn it off.

 

I'm interested to hear thoughts as I know there are a number of us on here who do this sort of thing.

 

I've often thought I should remove the php from the plugin and create the pages properly, but you know how it goes, you start something because it's easier and just stick with it !


Create new topic
marpada
487 posts

Ultimate Geek
+1 received by user: 182


  #1559306 25-May-2016 12:10
Send private message

mod_security is a very useful but high-maintenance tool that relies on sets of rules that on most occasions need to be tuned as there's no "one size fits all" set of rules. Completely understand your provider as keeping a set of rules just for you would be very time consuming.

 

 

 

As you said using Cloudfare WAF would be an easy win, as gives you a lot of control what modsec rules you want to use.




kingjj
1730 posts

Uber Geek
+1 received by user: 450

ID Verified
Trusted

  #1559349 25-May-2016 12:58
Send private message

You can set sites to be exempt from mod_sec rules. If you're providers using a control panel (eg Cpanel) there should be an option to add custom mod_sec rules. It's easy enough to set a site to be ignored or set your own rules. I'm not near my computer at present but later I can have a look for the code for this if need be. your provider can whitelist the specific domain easily at their end to save having to customise rules for your site.


timmmay
20858 posts

Uber Geek
+1 received by user: 5350

Trusted
Lifetime subscriber

  #1559353 25-May-2016 13:16
Send private message

Run up a t2.micro VM on AWS. Free the first year, US$10/month after that. You're your own sys admin though. Install Wordpress using EasyEngine, CloudFlare in front.




martyyn

1971 posts

Uber Geek
+1 received by user: 772

ID Verified

  #1559367 25-May-2016 13:45
Send private message

kingjj: Your provider can whitelist the specific domain easily at their end to save having to customise rules for your site.

 

I've asked them to remove it for now.

 

I was just wondering if what I had done so far was enough, or if I should persevere with modsec to really add some security.


timmmay
20858 posts

Uber Geek
+1 received by user: 5350

Trusted
Lifetime subscriber

  #1559371 25-May-2016 13:47
Send private message

CloudFlare will deal with some types of attacks, though their free version isn't really a WAF (web application firewall), it's really just a CDN with a few security features built in. Pay for their $20/month business plan if you want security.


martyyn

1971 posts

Uber Geek
+1 received by user: 772

ID Verified

  #1559376 25-May-2016 13:50
Send private message

timmmay:

 

CloudFlare will deal with some types of attacks, though their free version isn't really a WAF (web application firewall), it's really just a CDN with a few security features built in. Pay for their $20/month business plan if you want security.

 

 

That's what I thought, I will look at AWS in the future, I've considered it overkill for what I provide at the moment.


 
 
 

Shop on-line at New World now for your groceries (affiliate link).
timmmay
20858 posts

Uber Geek
+1 received by user: 5350

Trusted
Lifetime subscriber

  #1559382 25-May-2016 14:16
Send private message

An AWS VPS (they call it an instance) is pretty light. Surprising amount of resources for a really low price. My websites get around 500K hits per month (not pages, hits), and my t2.micro never runs out of usage credits. This means I get a full Xeon core whenever I need it. It is a lot more administration effort though - you have to patch Unix (which is easy - yum update / apt-get update), you have to upgrade software (also typically easy, unless you compile it yourself like I do for Nginx, but Easy Engine helps), but you're also the problem solver. I quite enjoy it :)


Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.