Fusker - a NodeJS security system that attacks back
github.com
github.com
var url = require('url');
exports.check = function (req, res) {
if (req.url.indexOf('../') > -1) {
fusker.handleAttack('LFI', req, res);
}
};
https://github.com/wearefractal/fusker/blob/master/lib/detec...That's very simplistic and I wouldn't be surprised if you could get round it with trickery like ..%2F or similar encodings since if you dig in it's being passed the req from the http Node.js module and using the .url parameter. That returns the full URL from the request itself.
And check out how SQL injection is detected: https://github.com/wearefractal/fusker/blob/master/lib/detec... It appears to be completely unimplemented.
Also, the whole 'fight back' idea is a bad one. We've seen from the spam world that fighting back tends to create collateral damage. If someone is attacking your web site then it's best just to silently discard attacks, after all if an attack back is detected that gives the attacker information.
Also, blacklisting IP addresses on the Internet is quite a dangerous thing to do. The IP address being presented to the end web site may well come from a company or from an ISP where there are many, many legitimate users on the same IP. A blacklist needs to be managed carefully to avoid an attacker knocking out a large group of legitimate users.
And yes, some things are not finished yet. The project was started a matter of hours ago and not even close to it's full potential
EDIT: Keep in mind you are the one who decides what modules and payloads to use. Blacklisting is optional
Hate to be a killjoy, but things like this are usually not a good idea. Unfortunately, somebody has to rediscover that every six months or so.
edit: nevermind, I was going off of hilariously out-of-date information. TCP ISNs haven't been easy to predict in -- gulp -- about a decade. Damn, now I feel old.
And if you had that level of control anyway, you wouldn't need to spoof attacks against the server, you could just redirect all incoming requests to a different server which returns whatever HTTP response headers or bodies that you want.
So your described attack is highly unlikely to ever happen.
How do you spoof your IP in TCP? If you spoof your source address you shouldn't be able to get past the handshake.
You spoof the IP address you are sending from and then predict the TCP sequence number so you can make it look as though you are receiving the replies (even though they are going to another machine since you spoofed the IP address).
Such an attack was proposed by Hacker News' very own rtm: http://tools.ietf.org/html/rfc1948
My bad, sorry for the noise.
edit: I suppose this means it's time for me to finally discard my copy of Inside TCP/IP, third edition. :-(
I think, a more realistic approach for example would be a ssh honeypot like kippo (https://code.google.com/p/kippo/).
Entire project was created in a matter of hours so it's pretty basic for now. Not a fan of the "this is lame shitsux" mentality going around but I'll get used to it. All included modules will become much more sophisticated with time so please hold those comments off until I get more than 2 hours to put towards the project
If you have any detection/payload suggestions please comment in here and I will most likely add them. Keep in mind that this is all for the lulz
If you have anything you want to add, feel free to fork!
Good luck though!
I think what's important to take away here is that people are genuinely interested in some sort of NodeJS web security framework given by the fact that people are viewing your source and commenting at all. If we thought it was a bad idea, I don't think you would have gotten any feedback at all. So, I think if you sift through the noise, you'll find a few folks will put up some good suggestions.
If you want to prevent this from happening there will be http-xss and socket-xss detectives in the future, just leave out the http-xss to keep it safe. Optionally you could always set your payloads to logging only
1. Detecting XSS by looking for '<', '>', '(', or ')' in the URL is a very naive approach. It can be bypassed fairly easily and many XSS vectors could have payloads constructed that bypass this filter. Also, you're likely to get some false positives for a certain subset of applications, since parenthesis have legitimate uses.
2. I'm not sure on what basis the first part of the CSRF protection is valid or what it's trying to protect. Is it looking for an Accept header for application/json?
3. The second part of the CSRF protection, which looks at the referer header, seems buggy and easy to bypass. What is it trying to accomplish? Right now, it seems like it blocks POST requests where the referer is set and contains the server's hostname (which valid requests will have).
4. Detecting CSRF by looking for non-GET/POST methods is a bad idea unless your application specifically constrains itself to those two methods. Many modern applications are using PUT and DELETE internally for routing purposes.
5. Detecting LFI in the URL by looking for ../ is, again, naive (although less likely to lead to false positives than the XSS testing).
6. The most "objectionable" part here seems to be the "fight back" options. There are definitely some legitimate concerns about an attacker being able to get a targeted user banned from a site (after all, you can't distinguish between a failed CSRF that an attacker is sending and a failed CSRF that an attacker tried to convince a target to send). For the most part though, I don't think they're a big deal for a small, independent site that opts-in to them: they sound a lot like the Miserable Users mod for VB (http://www.vbulletin.org/forum/showthread.php?t=93258)
That being said, no system that operates like a WAF is going to be perfect. The idea of a mod_security-like system for node.js is very cool though. I just think the way you tried to launch it here, with no indication on GitHub or otherwise that it's not a finished product, has led to some backlash. :-)
As I said to someone in another comment, the main purpose of the framework is socket.io packet analysis. The http detectives are merely for testing at this point while the framework itself matures
yes, i know that it doesn't "really" "attack back" but when you phrase it that way you're going to raise some hackles.
I think this project, much like all "offensive security" projects, is fundamentally misguided. At best, this project loudly alerts the hacker every time an attack is detected, providing an easy way to black-box test the service's attack detection criteria. At worst, it provides an easy way for jerks to goatse, Last Measure, etc. third parties using the webmaster's site. While I understand the kind of spiteful thrill that would come from redirecting a (maybe not) attacker to a shocking image, quietly stopping and logging the attack is always the best option.
1. Software notices inappropriate behavior.
2. Launches a honeypot service with lots of holes in it to give attacker opportunity to get root.
3. Root takes them to a locked down part of the computer.
4. Have the system project a computer where the admins are complete fools, making the attackers feel a false sense of security.
5. Send investigation information about the attacker to other servers running this software, ask other servers to "Help me find the bozo using this spoofed IP address". If you see someone transmitting on this IP, help me find its true origin.
The software could recursively trace right back to the ISP that is hosting the computer of the attacker. Don't have it launch a counter attack, the goal here is not to send the attacker to goatse (he probably enjoys it). The counterattack should be in the form of a policeman tapping the attacker on the shoulder and saying: "you have the right to remain silent".
The answer is not fighting back immediately, it's sun tzu's legendary advice, let the enemy think they have gamed your box, so they launch a bolder move, then you catch them with their hand in the cookie jar.