April 18, 2009

Indirect Object Syntax

In Perl, do not use: my $cgi = new Class;

Instead, always use: my $cgi = Class->new;

The section Indirect Object Syntax in the perlobj manual details why. While the indirect object syntax might appear “nice” or in the context of new “be easily distinguished from a method call,” these excuses belie the danger:

< mst> 'new Class' might invoke a method, or it might call a sub called 'new' in the current package, or it might fail to parse as a bareword, depending on the phase of the moon.

Technorati Tags:

April 13, 2009

Slow Brute Zombies

The slow brute zombies are back post details what appear to be distributed SSH password brute force attempts from clouds of compromised systems. This method avoids logscan countermeasures, where attackers making too frequent attempts from a single IP are blocked. pam_tally type blocks will still help, as these are applied at the account level, not source address level. However, the random connection attempts may cause a denial of service to legitimate users then locked out by pam_tally. On the other hand, root or admin should never be used for remote work, especially to Internet available servers. If the attacker knows or guesses a real account, they can cause problems. Defense in depth should be employed: block SSH except to port knocking sources, or only allow SSH access to users on a VPN. The VPN, in turn, should require at least two factor authentication: a password, and an RSA token, for example.

Where possible, also block or rate limit outgoing Internet traffic: no need to incur the bandwidth costs of illegitimate traffic escaping from your networks, nor the ire of remote sites who see your systems attacking them. Be sure to weigh the benefits of locking down outbound traffic with the risks of disrupting legitimate communications, and the complexities of maintaining a whitelist of permitted outgoing traffic.

PCI:DSS and other regulations frown upon shared accounts—especially administrative accounts. Excessive use of administrative accounts also increases the risk of a sloppy input causing a lesser or greater disaster, depending on the typo.

April 01, 2009

Regex Capture Quantifiers

Regular expression exercise: what does the following script emit?

#!/usr/bin/perl -wl use strict; my $text = 'abcdefghijklmnopq'; if ($text =~ m/(.)*/) { print $1; }

Technorati Tags: ,

Continue reading "Regex Capture Quantifiers" »

March 14, 2009

478576

f00li5h> there are a couple of hirings up in the air but i don't think i can maintain state on any more employment applications apeiron> f00li5h, Each time you send an application, file an RT ticket. Responses go in as replies. Set reminders and alerts and stuff so you don't forget. Establish a timeout period for tickets without any activity after a certain period of time to be closed automatically (I'm thinking an RT scrip can do this). If you do get hired, then you don't care about the system any more. apeiron> (ideally, as you're unemployed, you have the time for this) f00li5h> apeiron: haha, awesome ... people will get job application mails with the subject [#12] Perl web developer position   thrig> boost the serial to 478576 or something first apeiron> '478576' looks suspiciously like it was typed on a numberpad.      ik> I can't accidentally type that on either   thrig> apeiron: no, randomly typed on the top row apeiron> ah well   thrig> hmm, a little bit musical

478576.mid, 478576.mp3, and 478576.pdf.

Technorati Tags:

Solving Any Perl Problem

brian’s Guide to Solving Any Perl Problem.

Technorati Tags: