How to hack UNIX and Linux using wildcards

Leon Juranic from Croatian security research company Defensecode has written a rather good summary of some of the nasty tricks you can play on UNIX sysadmins by the careful choice of file names and the shell’s glob functionality.

The shell is the UNIX/Linux command line, and globbing is the shell’s wildcard argument expansion. Basically, when you type in a command with a wildcard character in the argument, the shell will expand it into any number of discrete arguments. For example, if you have a directory containing the files test, junk and foo, specifying cp * /somewhere-else will expand to cp test junk foo /somewhere else when it’s run. Go and read a shell tutorial if this is new to you.

Anyway, I’d thought most people knew about this kind of thing but I was probably naïve. Leon Juranic’s straw poll suggests that only 20% of Linux administrators are savvy.

The next alarming thing he points out is as follows:
Another interesting attack vector similar to previously described 'chown'
attack is 'chmod'.
Chmod also has --reference option that can be abused to specify arbitrary permissions on files selected with asterisk wildcard.

Chmod manual page (man chmod):
--reference=RFILE
use RFILE's mode instead of MODE values

 

Please generate and paste your ad code here. If left empty, the ad location will be highlighted on your blog pages with a reminder to enter your code. Mid-Post

Oh, er! Imagine what would happen if you created a file named “–reference=myfile”. When the root user ran “chmod 700 *” it’d end up setting the access permissions on everything to match those of “myfile”. chown has the same option, allowing you to take ownership of all the files as well.

It’s funny, but I didn’t remember seeing those options to chmod and chown. So I checked. They don’t actually exist on any UNIX system I’m aware of (including FreeBSD). On closer examination it’s an enhancement of the Linux bash shell, where many a good idea turns out to be a new vulnerability. That said, I know of quite a few people using bash on UNIX.

This doesn’t detract from his main point – people should take care over the consequences of wildcard expansion. The fact that those cool Linux guys didn’t see this one coming proves it.

This kind of stuff is (as he acknowledges) nothing new. One of the UNIX administrators I work with insists on putting a file called “-i” in every directory to stop wild-card file deletes (-i as an argument to rm forces an “Are you sure?” prompt on every file. And then there’s the old chestnut of how to remove a file with a name beginning with a ‘-‘. You can easily create one with:
echo test >-example
Come back tomorrow and I’ll tell you how to get rid of it!

Update 2nd July:

Try this:
rm ./-example

Hotpoint FDW65A dishwasher recall

I should be happy with Hotpoint. They have identified a fault in one of the modules fitted to the FDW20 FDW60 and FDW65A dishwashers that could lead to them catching fire. They’ve also traced customers (such as myself), written to them and asked to replace the module, using a “qualified engineer”. Are they bothering to use qualified engineers rather than trained technicians for such a menial job? Well I’m for anyone employing qualified engineers (with an engineering degree; registered with the engineering council and so on). I do hope they’re not telling porky pies about their educational status. I’ll let you know when he/she turns up!

For I have been waiting at home since 8am for said engineer to arrive. Apparently, if you have a “mobile”, they’ll TXT U A MRE PRCSE TM. If you don’t, or you’re in a zero coverage area so can’t receive SMS, you’re reliant to them to call you with a time. And I’ve been waiting by the ‘phone for just such a call. Or email, as arranged last week with customer services.

You can, however, call the premium rate telephone number that is given on the on the original letter and repeated prominently on subsequent emails. I think not. Anyone pulling this stunt in complete contempt of their supposedly valued customers doesn’t deserve any. They don’t even give a “premium rate” warning when quoting it, so I’m writing to Ofcom after I’ve posted this.

If you have one of these machines, sold in the UK with a serial number greater than 60600xxxxxxx, you can email them on fdw@hotpoint.co.uk. Hotpoint is actually a “brand” owned by Indesit, and you can call them at normal rates on 01733 287691 and try to get to the right department. If and when this engineer turns up I’ll update with the actual nature of  the fault (for any other qualified engineers out there who may be curious!)

 

Update:

Well the guy turned up and he was very nice, helpful and I can’t complain at all about him – in fact I’d have him back! He discovered about the cellphone blackspot when trying to get his laptop to connect back to base though. It turns out that the “problem” is with discrete spade connectors to the control board. Apparently this has been known to cause problems, presumably when they’re strained. So, new control board with caged contacts. I pointed out that this was a tenuous design flaw at best, but it turns out that BBC Watchdog has featured it. It sounds like more shoddy journalism blowing it out of proportion again.

 

Smart TVs attacked over the airwaves

A group of researchers from Columbia University have published the results of some experiments with mixed mode digital TV broadcasts here.

The problem is that the new but widely implemented HbbTV standard allows HTML to be embedded in with the picture data. What could possibly go wrong?

Well apart from the fact you only need an encoder and transmitter to mess up all the sets in range by sending them HTML spam, the Columbians reckon that with the right HTML you can turn people’s tellies into a botnet and attack targets through their internet connection. I’m not yet convinced this will work in practice, but building a web browser in to anything has always been risky when it implements more than plain HTM. It’s always been possible to broadcast alternative TV and radio signals over the top of legitimate channels, but generally, it doesn’t happen in practice.

 

Anonymous to attack World Cup sponsors

According to an article in the Guardian, Anonymous is planning attacks on World Cup sponsors to coincide with the football tournament in a few days time. Whilst I certainly disapprove of all types of cybercrime, I have to admit that the rationale for such an escapade has my sympathy.

Someone calling himself Che Commodore has claimed to be part of the Anonymous collective, and is a name that popped up a lot last year in connection with Anonymous Brazil. He’s hacked off because the Brazilian government is spending loads of money on a football tournament while people in the country are starving (putting the case directly and emotively). Attacking the commercial sponsors for colluding with this is an obvious choice.

Is he serious about the threat? The Guardian figures he must be, because he wouldn’t be boasting about it early unless everything was in place. I’m less convinced. Forewarning allows sites to get ready to use scrubbing centres against DDoS attacks. Is it really a “watch this space”, or is it a bluff? In the absence of any evidence that the self-styled Anonymous Brazil has the capabilities to carry out such an attack, I have to disagree with the Guardian (once again) and go with it being a bluff. But it’s a good one, as it’s raised awareness of the warped priorities that lead to huge amounts of money being spent on sports tournaments, in excesses reminiscent of the circus maximus. But you can only bluff once, and I suspect Mr Commodore’s stunt isn’t going to go down well with other users of the anonymous Moniker.

Personally I’m already boycotting as many of the sponsors as I can, but the intrigue has got me marginally interested in the World Cup for the first time ever.