LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-10-2015, 06:37 PM   #16
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78

Quote:
Originally Posted by astrogeek View Post
I have concluded over the past year that the battle is already lost on this front and have been actively changing and adapting my own practices from that point of view.
I understand your attitude -- and it was the relentless spamming of our forum that led to us closing that feature -- but I just can't believe things are that bleak. Perhaps I'm just naive and doomed to have my optimism slowly ground out of me. That linuxquestions.org and various other forums still thrive suggests that it is in fact possible to win the battle -- at least win it enough to run a useful website.

I'm familiar with mod_security and seem to recall that it tends to result in puzzling request failures where it's hard to determine the reason for the failure unless you are aware that modsec is in your machine, rejecting any suspicious requests.

Your thoughts about changing the nature of your business are helpful. On my site, for instance, it's entirely safe to fail any request with the string 'concat' or %20union' or 'information_schema'. Indeed, I can even ban any IP that so much as bothers to attempt a request including such strings. Surely there are some general tactics like this in use?
 
Old 11-10-2015, 07:16 PM   #17
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,266
Blog Entries: 24

Rep: Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195
Quote:
Originally Posted by sneakyimp View Post
...but I just can't believe things are that bleak.
Neither did I... until I finally did!

Quote:
Originally Posted by sneakyimp View Post
Perhaps I'm just naive and doomed to have my optimism slowly ground out of me.
Any optimisim I had was ground to fine dust over the pas 12-18 months. But I do not believe my own experience was exceptional. It is just in the course of things I came into full frontal contact with the situation which irreversibly changed my outlook. I hope that you can keep some comfortable distance from it, but for most of us I think that distance is accidental at best and subject to rapid, terrifying change.

Quote:
Originally Posted by sneakyimp View Post
That linuxquestions.org and various other forums still thrive suggests that it is in fact possible to win the battle -- at least win it enough to run a useful website.
I have no knowledge of how LQ manages things - they do a remarkable job of it! But in the end, I am sure they have already had great changes forced on them in the last few years, and that will continue.

If Jeremy is reading this thread I would like to solicit some general comments from Him on what it takes to keep the site going as it is, and trending of the slope of the cost and effort curve for the past few years.

Quote:
Originally Posted by sneakyimp View Post
I'm familiar with mod_security and seem to recall that it tends to result in puzzling request failures where it's hard to determine the reason for the failure unless you are aware that modsec is in your machine, rejecting any suspicious requests.
It is a poweful tool, but it takes dedicated effort to understand how to use it effectively. It is definitely not an "install and forget, just works" kind of thing! It puts your hands on the throttle and flight controls, but you have to understand how to fly it! The only way to get out of the puzzling mode is to eat the book, write your own rules and watch the feedback channels closely.

And remember, it is only applicable to one part of a much larger picture.

Quote:
Originally Posted by sneakyimp View Post
Your thoughts about changing the nature of your business are helpful. On my site, for instance, it's entirely safe to fail any request with the string 'concat' or %20union' or 'information_schema'. Indeed, I can even ban any IP that so much as bothers to attempt a request including such strings. Surely there are some general tactics like this in use?
Of course I know nothing of your own site, but SQL injections come in a bewildering variety, some of which do not look at all like SQL! If you look closer, I suspect that you will find these are only a subset of what is there.

In any event, good luck - I hope that your optimism prevails!
 
Old 11-11-2015, 04:16 PM   #18
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
After reading into it a little bit it occurred to me that sql injection is similar to zero day exploit.
If you knew about the injection possibility, you would of probably fixed it. In the same way, it doesn't make a whole lot of sense of how to defend against sql injection attacks past "make sure code is securely written originally".

I did notice this if you use mariadb that has a firewall plugin you can use to define rules. It may be useful to minimize injection attacks, even if impossible to stop them entirely. Other mysql servers may have similar firewalls
 
Old 11-11-2015, 05:48 PM   #19
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,662
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Actually, in many cases "SQL injection vulnerability" is a fault of (early) PHP, which did not provide the ability to execute SQL queries that contained placeholders.
 
Old 12-08-2015, 01:16 PM   #20
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
So I've been periodically scouring my access log for the past month or so. I feel like I might be winning. Server load is normal and obvious SQL injection hacks are getting shut down fairly effectively.

As a matter of curiosity, I'd like to know more about a really lengthy request in the access log recently. What is being attempted here? From my access log:
Code:
95.211.172.4 - - [06/Dec/2015:18:41:22 +0000] "POST /path/to/file.php?cat=999999.9'+%2f**%2fuNiOn%2f**%2faLl+%2f**%2fsElEcT+0x393133353134353632312e39,0x393133353134353632322e39,0x393133353134353632332e39,0x393133353134353632342e39,0x393133353134353632352e39,0x393133353134353632362e39,0x393133353134353632372e39,0x393133353134353632382e39,0x393133353134353632392e39,0x39313335313435363231302e39,0x39313335313435363231312e39,0x39313335313435363231322e39,0x39313335313435363231332e39,0x39313335313435363231342e39,0x39313335313435363231352e39,0x39313335313435363231362e39,0x39313335313435363231372e39,0x39313335313435363231382e39,0x39313335313435363231392e39,0x39313335313435363232302e39,0x39313335313435363232312e39,0x39313335313435363232322e39,0x39313335313435363232332e39,0x39313335313435363232342e39,0x39313335313435363232352e39,0x39313335313435363232362e39,0x39313335313435363232372e39,0x39313335313435363232382e39,0x39313335313435363232392e39,0x39313335313435363233302e39,0x39313335313435363233312e39,0x39313335313435363233322e39,0x39313335313435363233332e39,0x39313335313435363233342e39,0x39313335313435363233352e39,0x39313335313435363233362e39,0x39313335313435363233372e39,0x39313335313435363233382e39,0x39313335313435363233392e39,0x39313335313435363234302e39,0x39313335313435363234312e39,0x39313335313435363234322e39,0x39313335313435363234332e39,0x39313335313435363234342e39,0x39313335313435363234352e39,0x39313335313435363234362e39,0x39313335313435363234372e39,0x39313335313435363234382e39,0x39313335313435363234392e39,0x39313335313435363235302e39,0x39313335313435363235312e39,0x39313335313435363235322e39,0x39313335313435363235332e39,0x39313335313435363235342e39,0x39313335313435363235352e39,0x39313335313435363235362e39,0x39313335313435363235372e39,0x39313335313435363235382e39,0x39313335313435363235392e39,0x39313335313435363236302e39,0x39313335313435363236312e39,0x39313335313435363236322e39,0x39313335313435363236332e39,0x39313335313435363236342e39,0x39313335313435363236352e39,0x39313335313435363236362e39,0x39313335313435363236372e39,0x39313335313435363236382e39,0x39313335313435363236392e39,0x39313335313435363237302e39,0x39313335313435363237312e39,0x39313335313435363237322e39,0x39313335313435363237332e39,0x39313335313435363237342e39,0x39313335313435363237352e39,0x39313335313435363237362e39,0x39313335313435363237372e39,0x39313335313435363237382e39,0x39313335313435363237392e39,0x39313335313435363238302e39,0x39313335313435363238312e39,0x39313335313435363238322e39,0x39313335313435363238332e39,0x39313335313435363238342e39,0x39313335313435363238352e39,0x39313335313435363238362e39,0x39313335313435363238372e39,0x39313335313435363238382e39,0x39313335313435363238392e39,0x39313335313435363239302e39,0x39313335313435363239312e39,0x39313335313435363239322e39,0x39313335313435363239332e39,0x39313335313435363239342e39,0x39313335313435363239352e39,0x39313335313435363239362e39,0x39313335313435363239372e39+and+'0'='0 HTTP/1.1" 302 554 "http://example.com/path/to/file.php?cat=999999.9'+%2f**%2fuNiOn%2f**%2faLl+%2f**%2fsElEcT+0x393133353134353632312e39,0x393133353134353632322e39,0x393133353134353632332e39,0x393133353134353632342e39,0x393133353134353632352e39,0x393133353134353632362e39,0x393133353134353632372e39,0x393133353134353632382e39,0x393133353134353632392e39,0x39313335313435363231302e39,0x39313335313435363231312e39,0x39313335313435363231322e39,0x39313335313435363231332e39,0x39313335313435363231342e39,0x39313335313435363231352e39,0x39313335313435363231362e39,0x39313335313435363231372e39,0x39313335313435363231382e39,0x39313335313435363231392e39,0x39313335313435363232302e39,0x39313335313435363232312e39,0x39313335313435363232322e39,0x39313335313435363232332e39,0x39313335313435363232342e39,0x39313335313435363232352e39,0x39313335313435363232362e39,0x39313335313435363232372e39,0x39313335313435363232382e39,0x39313335313435363232392e39,0x39313335313435363233302e39,0x39313335313435363233312e39,0x39313335313435363233322e39,0x39313335313435363233332e39,0x39313335313435363233342e39,0x39313335313435363233352e39,0x39313335313435363233362e39,0x39313335313435363233372e39,0x39313335313435363233382e39,0x39313335313435363233392e39,0x39313335313435363234302e39,0x39313335313435363234312e39,0x39313335313435363234322e39,0x39313335313435363234332e39,0x39313335313435363234342e39,0x39313335313435363234352e39,0x39313335313435363234362e39,0x39313335313435363234372e39,0x39313335313435363234382e39,0x39313335313435363234392e39,0x39313335313435363235302e39,0x39313335313435363235312e39,0x39313335313435363235322e39,0x39313335313435363235332e39,0x39313335313435363235342e39,0x39313335313435363235352e39,0x39313335313435363235362e39,0x39313335313435363235372e39,0x39313335313435363235382e39,0x39313335313435363235392e39,0x39313335313435363236302e39,0x39313335313435363236312e39,0x39313335313435363236322e39,0x39313335313435363236332e39,0x39313335313435363236342e39,0x39313335313435363236352e39,0x39313335313435363236362e39,0x39313335313435363236372e39,0x39313335313435363236382e39,0x39313335313435363236392e39,0x39313335313435363237302e39,0x39313335313435363237312e39,0x39313335313435363237322e39,0x39313335313435363237332e39,0x39313335313435363237342e39,0x39313335313435363237352e39,0x39313335313435363237362e39,0x39313335313435363237372e39,0x39313335313435363237382e39,0x39313335313435363237392e39,0x39313335313435363238302e39,0x39313335313435363238312e39,0x39313335313435363238322e39,0x39313335313435363238332e39,0x39313335313435363238342e39,0x39313335313435363238352e39,0x39313335313435363238362e39,0x39313335313435363238372e39,0x39313335313435363238382e39,0x39313335313435363238392e39,0x39313335313435363239302e39,0x39313335313435363239312e39,0x39313335313435363239322e39,0x39313335313435363239332e39,0x39313335313435363239342e39,0x39313335313435363239352e39,0x39313335313435363239362e39,0x39313335313435363239372e39+and+'0'='0" "Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-PT; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)"
 
Old 12-08-2015, 03:36 PM   #21
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
The attack appends an extremely large hex values that will decode to a "null" value
in the hopes of matching the correct number of columns in the table.
says this, found by https://duckduckgo.com/?q=%22union+a...+in+access.log

I can't answer the next question on the grounds I don't know the answer.
 
Old 12-08-2015, 08:21 PM   #22
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
block the whole 255.255.0.0 subnet from those IP Addresses if you don't expect any visitors from those areas.

I know they might spoof the IP Address. On my case someone or some organization also tried to hack the FTP. We block the whole /16 subnet from known IPs that tried to hack.

Last edited by JJJCR; 12-08-2015 at 08:23 PM. Reason: edit
 
Old 12-10-2015, 08:03 AM   #23
learnin2cocatinate
Member
 
Registered: Nov 2015
Posts: 41

Rep: Reputation: Disabled
Im a newb but found this interesting and wondering why use md5 instead of pbkdf2 with iterations? I think this makes it so that it keeps generating new hashes but at the cost of more computational power? Also does the overall security problem with everything lie in the UNIX system design? Like could one make a new os thats not based on unix and make it impossible to hack? Also if it helps PfSense has PFblocker which has country block.

Last edited by learnin2cocatinate; 12-10-2015 at 02:25 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
False data injection Attack in ns-BGP newinubuntu Linux - Networking 0 02-14-2015 09:44 AM
LXer: Larry Ellison Uses Linux to Attack Microsoft SQL Server in Midmarket LXer Syndicated Linux News 0 09-23-2011 08:40 AM
SQL Injection inaki Linux - Security 6 06-04-2007 06:42 AM
sql injection inaki Linux - Security 8 12-22-2005 10:41 AM
Is SQL Injection traceable and is it a serious offence? novkhan Linux - Security 2 05-21-2004 10:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 06:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration