John Leach

Category: Security

Heroku tcp session information leakage

Created · Security, Tech

The Linux kernel exposes lots of interesting information via the /proc filesystem. For example, /proc/net/tcp and /proc/net/udp expose information about all tcp and udp sessions on the server.

In the usual Linux kernel style, these files are freely readable by all users on the Linux system. This becomes a bit of a problem on a multi-tenant system like Heroku. Heroku deploy many customers apps on each of their Amazon EC2 servers. So if you create an app skeleton, deploy to Heroku and shell out and you can see all the other apps tcp and udp sessions:

Continue reading “Heroku tcp session information leakage” →

Rate limiting with Apache and mod-security

Created · Security, Tech · 15 comments

Rate limiting by request in Apache isn't easy, but I finally figured out a satisfactory way of doing it using the mod-security Apache module. We're using it at Brightbox to prevent buggy scripts rinsing our metadata service. In particular, we needed th e ability to allow a high burst of initial requests, as that's our normal usage pattern. So here's how to do it.

Install mod-security (on Debian/Ubuntu, just install the libapache2-modsecurity package) and configure it in your virtual host definition like this:

SecRuleEngine On

<LocationMatch "^/somepath">
  SecAction initcol:ip=%{REMOTE_ADDR},pass,nolog
  SecAction "phase:5,deprecatevar:ip.somepathcounter=1/1,pass,nolog"
  SecRule IP:SOMEPATHCOUNTER "@gt 60" "phase:2,pause:300,deny,status:509,setenv:RATELIMITED,skip:1,nolog"
  SecAction "phase:2,pass,setvar:ip.somepathcounter=+1,nolog"
  Header always set Retry-After "10" env=RATELIMITED
</LocationMatch>

ErrorDocument 509 "Rate Limit Exceeded"

Continue reading “Rate limiting with Apache and mod-security” →

Segfault in Ruby Ferret query parser

Created · Ruby on Rails, Security

Whilst working with the Ruby text search engine library Ferret, I came across a segfault in the query parser. It had already been reported and fixed, but I realised it can lead to a denial of service.

If you use Ferret anywhere that allows users to execute queries, those users can crash the Ruby process with a specially crafted query.  This was quite serious for a number of my sites (not to mention slowing development of a current app) so I applied the fix to the released 0.11.4 source and repackaged it as 0.11.4.1.

Continue reading “Segfault in Ruby Ferret query parser” →

Encrypted partitions with Ubuntu/Debian

Created · Last updated · GNU/Linux, Security, Tech, Ubuntu · 16 comments

I figured out how to set up an encrypted partition on Ubuntu the other day. There are a bunch of ways of doing it but I found this to be the simplest. It should work on Debian too, since all the relevant packages are Debian ones anyway. In my example I'm encrypting an LVM partition (logical volume), but it should work with any device, including removable USB keys (see end notes). UPDATE: This is broken in Edgy but I figured out a simple fix, see below.

Continue reading “Encrypted partitions with Ubuntu/Debian” →

Opt-out of centralised NHS records

Created · Politics, Security

The government are centralising our medical information onto something called the "NHS Spine". So our entire NHS medical histories will be moved to this system opening it up to general access for millions more employees of:

  • various government agencies including the police and social workers
  • private investigators, media organisations and other commercial entities.

Well, you apparently have the legal right to opt out of this "data rape":

Continue reading “Opt-out of centralised NHS records” →

Referrer Securer

Created · Last updated · Security, Tech · 1 comment

Did you know that Firefox (and Epiphany) don't send referrers when following a link from an SSL encrypted site? The target site cannot tell whether you clicked a link or typed the url in directly.

I don't know about other browsers, but this seems like a sane behaviour.

Windows popup spam

Created · Last updated · Networks and Firewalls, Security, Tech · 11 comments

Whilst closely watching the traffic to a server here at work (I had a good reason, I don't just find it fun) (yes I do) I noticed a firewall batting away a bunch of incoming Microsoft Messenger Service NetrSendMessage. These are UDP packets destined for port 1026. The contents of the messages seem to be spyware and spam tricks. "Your system needs updating, click here to purchase the patch" etc.etc.

I've not come across this before, but it seems to be wide spread. In 2 hours I collected over a dozen to one particular host, all from different source IPs and nearly all with different messages and urls in them. Here are some excerpts, notice that as URLs aren't clickable in message boxes they have to leave instructions to type the url in.

UPDATE: For all the non-techies, these messages are NOT the result of a virus or worm or anything like that. They are just network messages sent over the internet by scammers, a bit like spam. You can safely ignore them. If you want them to go away, install some firewall software or follow the instructions by Manimo to turn off the messaging service.

Continue reading “Windows popup spam” →

Black Hat, Amsterdam

Created · Last updated · Networks and Firewalls, Personal, Security, Tech

I leave for Amsterdam on Wednesday where I'm attending the Black Hat Briefings. I was at DefCon in Las Vegas a few years ago so I'm interested to see what the BHB are like in comparison. I hope it's not just a big ugly advertis-a-thon. I'm there for a few days courtesy of work and will have photies to post when I get back I expect.

Continue reading “Black Hat, Amsterdam” →

grsecurity and selinux

Created · Last updated · GNU/Linux, Security, Tech

I'm playing with the grsecurity patches for Linux. Unfortunately 2.6.8 changed in a way that causes major headache for the grsec team, so no planned release date for a new patch. Having some problems with strange enforcements of rlimits, potentially linked to the rlimit auditing code. I'll hopefully get time to tinker with SELinux too.

air gap switch security

Created · Last updated · Security, Tech · 1 comment

Whale communications have invented something very secure, and very special. To the naked non-technical eye, their marketing material seems misleading and misguided, but this is the state of the art of security technology. It does some stuff to ensure undefined things do or do not happen.

Quote: "The patent-pending air gap switch keeps sensitive systems and data physically disconnected from untrusted networks and users, and transfers application-level data in real time. It is a high-speed, solid-state analog switch that connects a 512K memory bank to one SBC at a time via a SCSI interface. The air gap switch contains no Operating System, no TCP/IP address, no programmable units, all of which protects the appliance from being compromised. It hides internal addresses, preventing hackers' mapping of internal network and any tunnelling threat. It protects confidential information such as private keys and configuration data by placing them behind the "air gap."

Continue reading “air gap switch security” →