<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>IT Security Notes</title>
    <link rel="alternate" type="text/html" href="http://www.singapore-security.com/" />
    <link rel="self" type="application/atom+xml" href="http://www.singapore-security.com/atom.xml" />
   <id>tag:www.singapore-security.com,2007://1</id>
    <updated>2007-06-12T02:53:57Z</updated>
    <subtitle>IT Security research, notes, news, tips and random rants</subtitle>


<entry>
    <title>Death threat, a new form of Nigerian Scam ?</title>
    <link rel="alternate" type="text/html" href="http://www.singapore-security.com/2007/05/death_threat_a_new_form_of_nigerian_scam.html" />
    <id>tag:www.singapore-security.com,2007://1.2</id>

    <published>2007-05-24T13:23:21Z</published>
    <updated>2007-06-12T02:53:57Z</updated>

    <summary>A new Nigerian 419 fraud using scare tactics</summary>
    <author>
        <name>Fabrice A. Marie</name>
        <uri>http://www.singapore-security.com/about/fabrice</uri>
    </author>
    
        <category term="Miscellaneous" />
    
    <content type="html" xml:lang="en" xml:base="http://www.singapore-security.com/">
        <![CDATA[<p>
I received a funny death threat email this morning, as much as death threats can be funny in the first place.
It appeared straight away to be some sort of scam, but just to be sure and to have a good laugh,
I looked a bit at the email headers...
</p>]]>
        <![CDATA[<p>
<strong>The email</strong><br/>
Here comes the email I received (unmodified, but obviously lined-wrapped):
</p>

<blockquote>
<p align="justify">
<img src="/images/openq.png" alt="&#39;" width="15" height="20" align="bottom" /><br/>
<strong>Date:</strong> Wed, 23 May 2007 17:48:38  0100 (BST)<br/>
<strong>From:</strong> Kiss Death &lt;kiss_death31@yahoo.co.in&gt;<br/>
<strong>Subject:</strong> BE WARNED<br/>
<strong>To:</strong> kiss_death31@yahoo.co.in<br/><br/>

Sorry Marie,<br/><br/>
 
I am very Very sorry for you, is a pity that this is how your life is
going to end is a pity but I will like to give you some chance to help your self RIP.<br/><br/>
  
As you can see there is no need of introducing my self to you because I
don't have any business with you, My work as I am talking to you now is
just to kill you and a have to just do that as I have already been paid for that.
Some one that I will not like to tell you the name came to me and told me
that he want you and the whole of your family dead and he provide us with
your name, Address and Phone Number and with my network I sent my boys to
track you down and they have done that but I told them not to kill you that
I will like to contact you and see if your life is Important to you so<br/><br/>
  
Icalled the him back (I mean my client) and ask him of you email which I
didn't tell him what I want to do with it and he gave it to me and I am
using it to contact you. As I am writing to you now my men are
monitoring you and there telling me every thing about you.<br/><br/>
 
So I will like to know if you Like to live or die as some one has paid for you to die.<br/><br/>

I am given you just two days to get back to me or I will just make a call and tell my
boys to wipe you and your family out.<br/><br/>

GOOD LUCK AS I AWAIT YOUR REPLY.
<img src="/images/closeq.png" alt="&#39;" width="15" height="20" align="bottom" />
</p>
</blockquote>


<p>
<strong>Grammar and familiarities</strong><br/>
I'll pass on the obvious grammar mistakes (he did bother to run it through
a spell checker of some sort at least!) and move on straight the to familiarities...
</p>

<p>
I must say I hate when somebody call me by my family name just like that, without
any mister or whatever. I'm not a football star, nor a famous actor, so I don't deserve this treatment.
Besides, it reminds me too much of the army style. I believe it would be very interesting
to run that scam through an expert psychologist that would tell us what sentence or words
the naive public would react to in order to reply. Looks like a new sort of
<a href="http://en.wikipedia.org/wiki/Advance_fee_fraud">"Nigerian Scam"</a>.
</p>

<p>
<strong>Obvious scam</strong><br/>
Apparently the email comes from India if you believe at the usual <code>From: kiss_death31@yahoo.co.in</code> header.
However it would be deceiving, since the email has actually been sent from West Africa (Nigeria ?):
</p>

<blockquote>
<pre>
Received: from [208.70.7.28]
   by web94304.mail.in2.yahoo.com
   via HTTP; Wed, 23 May 2007 17:48:38 BST


# host 208.70.7.28
host28.fobsky7.juch-tech.com

# whois 208.70.7.28
Juch-Tech Inc JUCHTECH (NET-208-70-0-0-1)
                        208.70.0.0 - 208.70.7.255
F.O.B. SKY Inc. JTI-FOBSKY-6 (NET-208-70-6-0-1)
                        208.70.6.0 - 208.70.7.255

# links http://www.fobsky.com/aboutus.htm
[...] We offer two way internet over satellite [...]
in West Africa [...]
</pre>
</blockquote>

<p>
So it doesn't start so well for him. Why would an Indian guy want
to kill me, especially if he's in Africa (when I'm in the opposite part of the globe) ?
(by the way, for those of you who don't know where is <a href="http://en.wikipedia.org/wiki/Nigeria">Nigeria</a>
it is located in West Africa...)
</p>

<p>
Then of course, the email strategy stinks of rat scam. The killer tells you he has been paid loads of
money to kill you and all your family. He contacts you to tell you so. Hoping that you will
propose him to pay him more to leave you and your family in peace. Obviously, if you are
crazy/scared enough to reply him this, he will definitely tell you how much he supposedly
was paid and ask you to increase that sum substantially to drop the case.
</p>

<p>
<strong>Conclusion</strong><br/>
An obvious scam, so do not even bother to reply. Enough said.
</p>]]>
    </content>
</entry>

<entry>
    <title>Convert Windows&apos; dir /s to find format</title>
    <link rel="alternate" type="text/html" href="http://www.singapore-security.com/2006/12/convert_windows_dir_s_to_find.html" />
    <id>tag:www.singapore-security.com,2006://1.3</id>

    <published>2006-12-21T11:04:19Z</published>
    <updated>2007-06-12T07:41:18Z</updated>

    <summary>When you don&apos;t have find command on Windows this script may come handy</summary>
    <author>
        <name></name>
        
    </author>
    
        <category term="Windows Security" />
    
    <content type="html" xml:lang="en" xml:base="http://www.singapore-security.com/">
        <![CDATA[<p>
Sometimes you would like to convert the output
of DOS/Windows' <code>DIR /S</code> command into the
output of UNIX' <code>find</code> command.
You will find here a basic script that does just that.
</p>]]>
        <![CDATA[<p>
<strong>hugh?</strong><br/>
Sometimes some lazy or paranoid system administrator
refuses to install the <code>find</code> command
for Windows. So you are left only with the crappy Windows
basic commands. You could reply of course that if they
were so paranoid, they could download the source code,
inspect it and recompile it themselves.
</p>

<p>
<code>find</code> is extremely useful to get a nice file tree
that you can <code>grep</code> later from your Linux box
(unless again you installed <code>grep</code> on Windows).
</p>

<p>
<a name="conversion"></a><strong>The Script</strong><br/>
So when you don't have <code>find</code> and still need a basic
<code>find</code> output eventually, you could use this
<a href="/download/dir2find.pl">script</a>. It turns an output
that looks like this:
</p>

<blockquote>
<pre>
 Volume in drive C has no label.
 Volume Serial Number is B0B8-957C

 Directory of C:\WINDOWS

12/19/2006 09:36 PM &lt;DIR&gt;        .
12/19/2006 09:36 PM &lt;DIR&gt;        ..
12/21/2006 03:44 PM            0 0.log
03/21/2006 11:01 AM &lt;DIR&gt;        addins
08/23/2001 08:00 PM        1,272 Blue Lace 16.bmp
08/23/2001 08:00 PM       82,944 clock.avi
08/23/2001 08:00 PM       17,062 Coffee Bean.bmp
12/19/2006 06:49 PM       43,027 comsetup.log
03/21/2006 11:01 AM &lt;DIR&gt;        Config
03/21/2006 11:01 AM &lt;DIR&gt;        Connection Wizard
03/21/2006 04:02 AM            0 control.ini
03/21/2006 03:55 AM &lt;DIR&gt;        Cursors
10/11/2006 05:43 PM &lt;DIR&gt;        Debug
...
</pre>
</blockquote>

<p>
Into an output that looks like this:
</p>

<blockquote>
<pre>
C:/WINDOWS
C:/WINDOWS/0.log
C:/WINDOWS/Blue Lace 16.bmp
C:/WINDOWS/clock.avi
C:/WINDOWS/Coffee Bean.bmp
C:/WINDOWS/control.ini
C:/WINDOWS/comsetup.log
C:/WINDOWS/addins
C:/WINDOWS/Config
C:/WINDOWS/Connection Wizard
C:/WINDOWS/Cursors
C:/WINDOWS/Debug
...
</pre>
</blockquote>

<p>
The <a href="/download/dir2find.pl">script</a> makes it easy to <code>grep</code>
for particular files like <code>.exe</code> or <code>.log</code>
or any other pattern that you may be looking for.
</p>

<p>
<a name="native"></a><strong>Native GNU tools on Windows</strong><br/>
The better alternative of course is to install some vital
GNU tools onto your Windows system.
</p>

<p>
<em>Karl M. Syring</em> has ported essential GNU tools to native Windows
on his <a href="http://unxutils.sourceforge.net/">http://unxutils.sourceforge.net/</a> project.
</p>

<blockquote>
<p>
<img src="/images/openq.png" alt="&#39;" width="15" height="20" align="bottom" />
Here are some ports of common GNU utilities to native Win32.
In this context, native means the executables do only depend
on the Microsoft C-runtime (<code>msvcrt.dll</code>) and not an
emulation layer like that provided by Cygwin tools.
<img src="/images/closeq.png" alt="&#39;" width="15" height="20" align="bottom" />
</p>
</blockquote>

<p>
The tools included (at the time of this writing) are:
</p>

<blockquote>
<table border="0" summary="This table gives a quick list of tools included.">
<tr><td>bc</td><td>bison</td><td>bzip2</td><td>diffutils</td></tr>
<tr><td>fileutils</td><td>findutils</td><td>flex</td><td>gawk</td></tr>
<tr><td>grep</td><td>gsar110</td><td>gzip</td><td>indent</td></tr>
<tr><td>jwhois</td><td>less</td><td>m4</td><td>make</td></tr>
<tr><td>patch</td><td>recode</td><td>rman</td><td>sed</td></tr>
<tr><td>shellutils</td><td>tar</td><td>textutils</td><td>unrar</td></tr>
<tr><td>wget</td><td>which</td><td></td><td></td></tr>
</table>
</blockquote>

<p>
<a name="emulated"></a><strong>Emulated GNU tools on Windows</strong><br/>
A team of enthusiasts originally from Cygnus (now part of RedHat) have
created an emulation layer that allows to re-compile and run most GNU or standard
Linux tools on Windows. You can download this environment called
<a href="http://www.cygwin.com/">cygwin</a> (in pre-compiled binary, or in source form).
</p>

<blockquote>
<p>
<img src="/images/openq.png" alt="&#39;" width="15" height="20" align="bottom" />
Cygwin is a Linux-like environment for Windows. It consists of two parts:
</p>
<ul>
<li>A DLL (<code>cygwin1.dll</code>) which acts as a Linux API emulation layer providing
substantial Linux API functionality.</li>
<li>A collection of tools which provide Linux look and feel.</li>
</ul>
<p>
The Cygwin DLL works with all non-beta, non "release candidate",
ix86 32 bit versions of Windows since Windows 95, with the exception of Windows CE.
<img src="/images/closeq.png" alt="&#39;" width="15" height="20" align="bottom" />
</p>
</blockquote>

<p>
Cygwin contains an amazing number of GNU or Linux tools that come very handy on Windows,
including mamoths like
<a href="http://www.x.org"><code>XWindow</code></a>,
<a href="http://www.xemacs.org/"><code>XEmacs</code></a>,
<a href="http://www.openssh.com/"><code>openssh</code></a> or
<a href="http://www.gnu.org/software/ddd/"><code>ddd</code></a>
</p>

<p>
<strong>Conclusion</strong><br/>
In order of robustness &amp; speed you should use:
</p>

<ul>
<li>the <a href="#native">native</a> version of <code>find</code></li>
<li>or the <a href="#emulated">cygwin</a> version of <code>find</code></li>
<li>or the <a href="#conversion">script</a> converting output from Windows' <code>DIR /S</code>
into <code>find</code> format</li>
</ul>]]>
    </content>
</entry>

<entry>
    <title>ATM pin reversal scam</title>
    <link rel="alternate" type="text/html" href="http://www.singapore-security.com/2006/12/atm_pin_reversal_scam.html" />
    <id>tag:www.singapore-security.com,2006://1.4</id>

    <published>2006-12-17T16:34:26Z</published>
    <updated>2006-12-17T16:34:26Z</updated>

    <summary>How can people be so naive as to believe such a scam letter...</summary>
    <author>
        <name>Fabrice A. Marie</name>
        <uri>http://www.singapore-security.com/about/fabrice</uri>
    </author>
    
        <category term="Miscellaneous" />
    
    <content type="html" xml:lang="en" xml:base="http://www.singapore-security.com/">
        <![CDATA[<p>
A scam letter is circuclating in Singapore
telling potential victims of ATM money snatching how to
call the police automatically. How naive people can be...
</p>]]>
        <![CDATA[<p>
<strong>The letter</strong>
</p>

<blockquote>
<p>
<img src="/images/openq.png" alt="&#39;" width="15" height="20" align="bottom" />
If you should ever be forced by a robber to withdraw money from an ATM
machine, you can notify the police by entering your PIN number in reverse.
For example if your pin number is 1234 then you would put in 4321. The
ATM recognizes that your pin number is backwards from the ATM card you
placed in the machine.<br /><br />
The machine will still give you the money you requested, but unknown to
the robber, the police will be immediately dispatched to help you.<br /><br />
This information was recently broadcasted on TV and it states that it is
seldom used because people don't know it exists.
<img src="/images/closeq.png" alt="&#39;" width="15" height="20" align="bottom" />
</p>
</blockquote>

<p>
<strong>Why is it nonsense?</strong>
</p>

<ol>
<li>What happens if your pin is the same in straight
    order as in reverse order? (i.e.: <code>9229</code>, <code>3113</code>, etc...)</li>
<li>Tell me (without thinking more than a second) you PIN number
    in reverse... can you? You probably would have to think longer...</li>
<li>How would the bank call the police? And who would
    be responsible if people would start abusing this "service" in
    case the bank calls automatically?</li>
<li>Even if the police gets automatically notified, by the time they do actually reach the ATM,
    the robber will be long gone with your cash... (and maybe your life)</li>
</ol>

<p>The old saying <em>"Your money or your life!"</em> has always been ill-worded.
It should have been <em>"Your money or your life AND your money!"</em>
</p>

<p>
<strong>What could work?</strong><br/>
On the other hand we could think of better protections from ATM money snatching.
I'm not really serious with these recommendations, but it would be fun if it existed:
</p>

<ul>


<li><em>The out of money solution</em><br/>
The bank could put in place a discreet button or a buttons-combination that
when pressed would instruct the ATM
to refuse dispensing money, appearing to have ran out of money. The thief would genuinely
believe that this particular ATM ran out of money (that's
<a href="http://www.murphys-laws.com/">Murphy's Law</a> after all), and would
walk away (with or without your ATM card, and with or without having taken your life!).<br/><br/>
Of course for this to work, the bank would need to enable this function only to people who already
successfully entered their PIN, otherwise non-customers would definitely abuse this to cause
<acronym title="Denial of Service">DoS</acronym>. Of course this does not prevent the thief to
steal your money, it's just that he wouldn't be able to steal it right here right now, he me still
steal your ATM card, and kill you after you reveal him your code...<br/>&nbsp;<br/>
</li>
<li><em>The 5<sup>th</sup> Element Solution</em><br/>
    [ You should really watch The
    <a href="http://www.sonypictures.com/homevideo/thefifthelement/title-navigation-2.html">5<sup>th</sup> Element</a>
    if you haven't seen it yet. ]
    Anyway at some point in the movie, a bad guy attempts to pass as somebody else
    at an airline check-in counter and gets detected. Straight away a cage falls on him
    and prevent him from leaving, electronic aimed machine guns point at him to deter him
    from trying to break the cage, and a loud alarm start ringing.<br/><br/>
    Now that would be a great way to prevent a bunch of ATM attacks like ATM money snatching,
    ATM tampering, ATM forcing and more! Having said that it's a bit extreme... ;-)<br/>&nbsp;<br/>
</li>
<li><em>The Run! Forest, run! solution</em><br/>
Of course the best solution is to run as fast as you can. There's nothing better than a big
guy with a big blade pointed towards you to motivate you to break the 100 meters sprint world record...
</li>
</ul>
]]>
    </content>
</entry>

<entry>
    <title><![CDATA[ATM Security &amp; NETs Security]]></title>
    <link rel="alternate" type="text/html" href="http://www.singapore-security.com/2006/11/atm_security_nets_security.html" />
    <id>tag:www.singapore-security.com,2006://1.5</id>

    <published>2006-11-13T17:12:38Z</published>
    <updated>2006-11-13T17:12:38Z</updated>

    <summary>NETs enabled machines and POS could be a vector for ATM fraud</summary>
    <author>
        <name>Fabrice A. Marie</name>
        <uri>http://www.singapore-security.com/about/fabrice</uri>
    </author>
    
        <category term="Banking Security" />
    
    <content type="html" xml:lang="en" xml:base="http://www.singapore-security.com/">
        <![CDATA[<p>
Recently, Singapore has had a wave of
<a href="http://www.google.com/search?q=singapore+%27ATM+frauds%27">ATM Frauds</a>.
Measures have been taken by banks to monitor and attempt to avoid ATM
frauds as much as possible. If someone performs a fraud
using a copy of your ATM card, chances are that the bank will issue
you a new ATM card, and will reimburse you immediately the missing money.
</p>

<p>
What happens on NETs enabled machines?
</p>]]>
        <![CDATA[<p>
<strong>Introduction</strong><br/>
<a href="http://www.nets.com.sg/"><acronym title="Network for Electronic Transfers">NETs</acronym></a>
enabled machine are all over Singapore.
</p>

<blockquote>
<img src="/images/openq.png" alt="&#39;" width="15" height="20" align="bottom" />
<a href="http://www.nets.com.sg/">NETS</a> was founded as
a result of a need for a centralised e-Payment operator
by Singapore's local banks:
<a href="http://www.dbs.com/">DBS</a>,
<a href="http://www.keppelbank.com.sg/">Keppel Bank</a>,
<a href="http://www.ocbc.com/">OCBC</a>,
<a href="http://www.uobgroup.com/">OUB</a>,
<a href="http://www.dbs.com/posb/">POSB</a>,
<a href="http://www.keppelbank.com.sg/">Tat Lee Bank</a> and
<a href="http://www.uobgroup.com/">UOB</a>, in 1985.
<img src="/images/closeq.png" alt="&#39;" width="15" height="20" align="bottom" />
</blockquote>

<p>
NETs enabled machines are machines that accept payment via the NETs network.
All local banks ATM cards support NETs, which make these NETs enabled machine
very convenient to use.
</p>

<p>
You can use NETs in government building when paying for various fees,
in super markets and almost every shop in Singapore (notorious exceptions
are food stalls and pubs or cafes). You can use NETs to pay your bills on
<a href="http://www.singpost.com.sg/SAM/"><acronym title="Self-service Automated Machine">SAM</acronym> machines</a>,
or <a href="http://www.axs.com.sg/">AXS</a> machines. You can also top-up your public
transport fare card using NETs. Now you can use NETs to pay
for your cab fares too. NETs is basically everywhere and extremely convenient.
</p>

<p>
<strong>Problem with ATM cards</strong><br/>
Most ATM cards are just a dumb storage media. On the magnetic strip of the
card is encoded such information as your bank ID and your bank account number
among others. Information encoded on your ATM card is not encrypted, and
therefore anybody with a magnetic card reader can swipe your card in, in order
to copy it.
</p>

<p>
There is a little problem with reading ATM cards using off-the-shelf magnetic
card reader. The driver of the magnetic card reader will validate the content
of the card against the checksum to protect against read errors. ATM cards usually
have an invalid checksum on purpose. So reading them with regular magnetic card readers
will fail. In order to succeed, you have to have a lower-lever card reader, or a
'dumb card reader' that does not validate checksums.
</p>

<p>
Of course the card alone is not enough to perform a fraud. An attacker would
also need the corresponding
<acronym title="Personal Identification Number">PIN</acronym>.
Recent ATM frauds are based on stealing the card information and the PIN at the same
time. Some fraudsters have put a mini magnetic card reader just before the real ATM's
card reader: when the victim slides-in his card into the ATM, the fraudster's reader reads
the card, then when the card goes deeper the ATM card reader can read the card.
It is completely transparent to the victim. The fraudster before hand
has put a pin-hole camera in the corner
of the ATM booth so he can record the victim's PIN while he types it.
</p>

<p>
<strong>Mitigating Factor</strong><br/>
The biggest mitigating factor is the fact that every ATM has a CCTV camera attached
to it, so that anybody approaching the ATM will be seen and could potentially be identified
after a successful attack. Banks put in place specially shaped card reader enclosures
to make it easier for a phony card reader to be spotted by a user.
</p>

<p>
<strong>Convenience vs. Security</strong><br/>
While AXS stations seem to have a
<a href="http://www.axs.com.sg/axs_station/about_axs_station/about_axs_station.asp">digital camera</a>,
apparently it is only used to take digital pictures, which is used for application like ePostcards.
It does not appear to be CCTV like, in the sense that it does not appear that it films every
users while they approach or use the machine.
</p>

<p>
SAM machines do not have cameras either. Almost all <acronym title="Point Of Sale">POS</acronym>
in Singapore do not have a CCTV camera or have a CCTV camera that cannot see if the cashier
swipes the NETs card in the rightful reader or if he swipes it in a recording card reader device
first. If such an employee (cashier, taxi driver, etc..) decides to become rogue and steal ATM card
information it would be absolutely trivial, and the user would not notice, since he would not
be the one sliding the card himself. Before the user realizes his card was misused, it would
be too late, and he would have no idea which merchant is to blame.
</p>

<p>
<strong>Possible Solution</strong><br/>
A possible solution would be to have a hardware token, very much like the ones recently launched

for Internet Banking by Singapore banks.
</p>

<p>
A user could use the same hardware token on ATMs. Before asking for the PIN, the ATM or POS
would check if the card supports NETs. If it does, it would request for the hardware token
displayed number <strong>instead of</strong> asking for the PIN. These hardware token displayed numbers
are time dependent and cannot be re-used. A fraudster could still copy the card
and film the user entering the number, it would become useless:
</p>

<ul>
<li>The number cannot be reused</li>
<li>The number would not be supported on foreign ATMs since it is not the usual PIN</li>
</ul>

<p>
If the card is a foreign card that does not support NETs and instead
supports VISA, PLUS, or any other usual payment network,
then the ATM would ask for the usual PIN and the protection would not apply.
</p>

<p>
A user of a Singaporean bank ATM card overseas would still have to enter his PIN.
But at least using his card in Singapore, the user would face no risk (and neither would
the bank or the merchant).
</p>

<p>
<strong>Conclusion</strong><br/>
Although this solution would prove to be very effective (the only way to defeat it is to
steal/copy the card and the token, as opposed to just steal/copy the card and watch the PIN),
it would end-up being costly for the bank:
</p>

<ul>
<li>Each ATM customer would require on hardware token (could be shared for his
various cards: credit card, ATM card, Internet Banking)</li>
<li>Bank would have to have an extensive support program in place to teach users
how to use the token during the first few months of the transition</li>
</ul>

]]>
    </content>
</entry>

<entry>
    <title>Automating SpamCop Reporting</title>
    <link rel="alternate" type="text/html" href="http://www.singapore-security.com/2006/11/automating_spamcop_reporting.html" />
    <id>tag:www.singapore-security.com,2006://1.6</id>

    <published>2006-11-12T09:15:05Z</published>
    <updated>2006-11-12T09:15:05Z</updated>

    <summary>Avoid clicking on &apos;Submit&apos; for each message of your SpamCop queue, instead use this Perl script to automatically process them for you.</summary>
    <author>
        <name>Fabrice A. Marie</name>
        <uri>http://www.singapore-security.com/about/fabrice</uri>
    </author>
    
        <category term="Miscellaneous" />
    
    <content type="html" xml:lang="en" xml:base="http://www.singapore-security.com/">
        <![CDATA[<p>
SpamCop is great. You should subscribe, it's worth it
and it's for a worthy cause. However, it's a real pain
to report 100 spam messages at a time. We propose here
a quick Perl script that processes your SpamCop queue.
</p>]]>
        <![CDATA[<p>
<strong>Introduction</strong>
</p>
<blockquote>
<img src="/images/openq.png" alt="&#39;" width="15" height="20" align= "bottom" />
<a href="http://www.spamcop.net/">SpamCop</a>
is a service for reporting spam.  SpamCop determines the origin
of unwanted email and reports it to the relevant Internet service
providers.  By reporting spam, you have a positive impact on the
problem.  Reporting unsolicited email also helps feed spam filtering
systems, including, but not limited to, the SpamCop blacklist used in
SpamAssassin as a DNSBL.<br/><br/>
Unfortunately, this is an ongoing battle. Spammers adapt quickly and persistently.
Report spam and help SpamCop turn the tide. SpamCop makes this otherwise slow
and technical task quick and easy.
<br/><br/>

The SpamCop reporting service is free.
<img src="/images/closeq.png" alt="&#39;" width="15" height="20" align="bottom" />
</blockquote>

<p>
The easiest way to use SpamCop is to
<a href="http://www.spamcop.net/anonsignup.shtml">sign up</a> with them.
The best is to support them is through
<a href="http://www.spamcop.net/fom-serve/cache/300.html">donations</a>
or to sign up for their <a href="http://www.spamcop.net/ces/individuals.shtml">services</a>
</p>

<p>
<strong>Sending Your Spam to SpamCop</strong><br/>
Once you have your account set up, I recommend that you forward your complete
spam message using attachments, to your personal spam reporting email address instead of going
through the pain of submitting them via the web based form.
Mine looks like this (scrubbed): <code>submit.hXfjblahblablahB@spam.spamcop.net</code>.<br/><br/>
<strong>Note:</strong> make sure you forward to your personal spam reporting address
<strong>only</strong> genuine spam!
</p>

<p>
I use the excellent <a href="http://www.mozilla.com/thunderbird/">Thunderbird</a> with
the <a href="https://addons.mozilla.org/search.php?q=Okopipi&amp;app=thunderbird">Okopipi plugin</a>.
</p>

<blockquote>
<img src="/images/openq.png" alt="&#39;" width="15" height="20" align= "bottom" />
Okopipi plugin for thunderbird reports spam to SpamCop,
to the FTC, FDA, SEC, ACMA and/or <a href="http://www.knujon.com">Knujon.com</a>.
It also allows you to put in your own custom addresses to report spam to such
as your ISP or corporate abuse address.<br/><br/>

This will properly forward any message in your current folder marked as junk to
the places you configure in your preferences. All you will have to do is hit send.
<img src="/images/closeq.png" alt="&#39;" width="15" height="20" align="bottom" />
</blockquote>

<p>
After you have installed Okopipi, configure it to forward spam to your personal SpamCop
reporting address. <em>Customize</em> your
top
-window
 thunderbird toolbar: right click on toolbar&nbsp;-&gt;&nbsp; <em>Customize</em>.
Add the Okopipi <em>Report</em> button to your toolbar.
</p>

<p>
All you have to do now when you receive email, is to carefully mark
as <em>Junk</em> spam messages <strong>and</strong> to mark as <em>Not Junk</em> these
emails that were incorrectly marked as junk by Thunderbird. Then hit the Okopipi
<em>Report</em> button, and click <em>send</em>. SpamCop will receive all your spam, ready to
report them for you.
</p>

<p>
<strong>Getting SpamCop to Report the Spam Messages for you</strong><br/>
A this point, you may have a few dozens email messages in your SpamCop queue.
The main problem right now is that SpamCop requires you to report your spam messages one
by one. To report a spam and remove it from the queue, you have to perform 2 clicks.
It's hardly usable: if you just forwarded 100 messages that would make 200 clicks...
</p>

<p>
I seriously hate to click, so I spent half an hour writing a simple Perl script
that would process the SpamCop reporting web-based forms, and click "submit" on my
behalf. It basically does the monkey job of clicking through all the web based forms for
you, all from one command line.
</p>

<p>
<strong>The Script</strong><br/>
You can download the script <a href="/download/report_spam.pl">here</a>. Save it somewhere.
And don't forget to edit it to reflect your SpamCop settings.
</p>

<p>
Edit the following stanza to match your settings:
</p>
<blockquote>
<pre>
##########################################
##
## EDIT HERE
##
##########################################
my $username = 'william.gates@msn.com';
my $password = 'My Password Rocks';
##########################################
</pre>
</blockquote>

<p>
Further down, you may want to set your HTTP proxy address if you are using any.
Uncomment the following line, and set your proxy:
</p>

<blockquote>
<pre>
# if you need proxy, uncomment that.
# $browser->proxy(['http', 'ftp'],
'http://username:password@127.0.0.1:8080/');
</pre>
</blockquote>

<p>
Don't forget to modify the ISP settings, lower down in the script.
I could have made a configurable array at the beginning of the file,
but I was seriously lazy to do it..
</p>


<p>
You are almost ready to go. Now you'll have some Perl modules dependencies to solve first.
</p>

<p>
<strong>Necessary Perl Modules</strong><br/>
use <a href="http://search.cpan.org/search?query=Tie%3A%3AInsertOrderHash&amp;mode=all">Tie::InsertOrderHash</a>;<br/>
use <a href="http://search.cpan.org/search?query=LWP&amp;mode=all">LWP</a>;<br/>
use <a href="http://search.cpan.org/search?query=HTTP%3A%3ACookies&amp;mode=all">HTTP::Cookies</a>;<br/>
use <a href="http://search.cpan.org/search?query=HTML%3A%3ATreeBuilder&amp;mode=all">HTML::TreeBuilder</a>;<br/>
use <a href="http://search.cpan.org/search?query=MIME%3A%3ABase64&amp;mode=all">MIME::Base64</a>;<br/>
</p>

<p>
Some of these modules may already be installed on your Linux or *BSD distribution. Most
of them will be available as a distribution package in <code>.rpm</code>,
<code>.deb</code>, <code>.pkg</code>, etc... or you can download
them manually and install. Additionally you may want to use the
<a href="http://www.perl.com/doc/manual/html/lib/CPAN.html">CPAN Shell</a> to download the module
and any dependency.
</p>

<p>
<strong>Warning</strong><br/>
Please use this script only to report <strong>genuine</strong> spam.
If you abuse this script, SpamCop will respond by changing its form
to include Captchas which will disturb real users even more and that
will totally spoil the purpose of this script.
</p>

<p>
Enjoy. If you have any problem with that script, don't hesitate to comment.<br/>
Download the script <a href="/download/report_spam.pl">here</a>.
</p>

<p>
<strong>Update 2006-11-17</strong><br/>
Apparently, there is a similar script available on sourceforge called
<a href="http://sourceforge.net/projects/spamcup">SpamCup</a>.
I haven't checked yet to see how the two scripts compare though.
</p>

]]>
    </content>
</entry>

<entry>
    <title>SSL cipher suite choice</title>
    <link rel="alternate" type="text/html" href="http://www.singapore-security.com/2006/10/ssl_cipher_suite_choice.html" />
    <id>tag:www.singapore-security.com,2006://1.7</id>

    <published>2006-10-16T10:38:00Z</published>
    <updated>2006-10-16T10:38:00Z</updated>

    <summary>Configure your SSL enabled services to support only the strongest ciphers to avoid man-in-the-middle attacks.
</summary>
    <author>
        <name>Fabrice A. Marie</name>
        <uri>http://www.singapore-security.com/about/fabrice</uri>
    </author>
    
        <category term="System Security" />
    
    <content type="html" xml:lang="en" xml:base="http://www.singapore-security.com/">
        <![CDATA[<p>
What's the risk of allowing low-grade encryption algorithms
on your SSL-enabled server?
</p>
]]>
        <![CDATA[<p>
<strong>Cipher Negotiation</strong><br/>
During the SSL handshake, the client and the server
will negotiate which encryption algorithm they should use.
The principle behind that is that clients or servers
do not have to implement all of the ciphers supported by SSL.
Especially since in the past, US export laws regarding cryptography
were very clear: no strong cryptography could be exported out
of USA without a license. This law relaxed after 
<a href="http://www.philzimmermann.com/">Phil Zimmermann</a>
invented and <strong>exported</strong>
<acronym title="Pretty Good Privacy">PGP</acronym>.
</p>

<p>
Attacker may attempt some man-in-the-middle attack whereby they
fool the client and the server to negotiate a weak cipher suite.
Note also that some web browser are too old, and still locked
to "export grade" ciphers. In any case the result ends up the same,
the cipher negotiated during the SSL handshake may not be strong enough,
and a man-in-the-middle could decrypt the traffic.
</p>

<p>
<strong>Solution</strong><br/>
A common solution is to force your web-server (or any other SSL enabled
service that can be configured in such a way) to accept only strong
ciphers during the negotiation.
</p>

<p>
On apache, you can do this in the <a href="http://www.modssl.org/">mod_ssl</a>
configuration file. The keyword that you need to modify is
<code>SSLCipherSuite</code>.
</p>

<p>
My cipher suite line looks like this (all on one line):
</p>
<blockquote>
<code>SSLCipherSuite !EXPORT40:!EXPORT56:!LOW:!ADH:!NULL:!AECDH-AES256-SHA:
!AECDH-AES128-SHA:!AECDH-DES-CBC3-SHA:!AECDH-RC4-SHA:
!RC2-CBC-MD5:SSLv3:SSLv2:TLSv1</code>
</blockquote>

<p>
This translates to having the following ciphers enabled:
</p>
<blockquote>
<code># openssl ciphers -v
'!EXPORT40:!EXPORT56:!LOW:!ADH:!NULL:!AECDH-AES256-SHA:
!AECDH-AES128-SHA:!AECDH-DES-CBC3-SHA:!AECDH-RC4-SHA:
!RC2-CBC-MD5:SSLv3:SSLv2:TLSv1'</code>
<pre>
DHE-RSA-AES256-SHA   SSLv3 K=DH   A=RSA  E=AES(256)  M=SHA1
DHE-DSS-AES256-SHA   SSLv3 K=DH   A=DSS  E=AES(256)  M=SHA1
AES256-SHA           SSLv3 K=RSA  A=RSA  E=AES(256)  M=SHA1
DHE-RSA-AES128-SHA   SSLv3 K=DH   A=RSA  E=AES(128)  M=SHA1
DHE-DSS-AES128-SHA   SSLv3 K=DH   A=DSS  E=AES(128)  M=SHA1
AES128-SHA           SSLv3 K=RSA  A=RSA  E=AES(128)  M=SHA1
DHE-DSS-RC4-SHA      SSLv3 K=DH   A=DSS  E=RC4(128)  M=SHA1
KRB5-RC4-MD5         SSLv3 K=KRB5 A=KRB5 E=RC4(128)  M=MD5 
KRB5-DES-CBC3-MD5    SSLv3 K=KRB5 A=KRB5 E=3DES(168) M=MD5 
KRB5-RC4-SHA         SSLv3 K=KRB5 A=KRB5 E=RC4(128)  M=SHA1
KRB5-DES-CBC3-SHA    SSLv3 K=KRB5 A=KRB5 E=3DES(168) M=SHA1
EDH-RSA-DES-CBC3-SHA SSLv3 K=DH   A=RSA  E=3DES(168) M=SHA1
EDH-DSS-DES-CBC3-SHA SSLv3 K=DH   A=DSS  E=3DES(168) M=SHA1
DES-CBC3-SHA         SSLv3 K=RSA  A=RSA  E=3DES(168) M=SHA1
RC4-SHA              SSLv3 K=RSA  A=RSA  E=RC4(128)  M=SHA1
RC4-MD5              SSLv3 K=RSA  A=RSA  E=RC4(128)  M=MD5 
DES-CBC3-MD5         SSLv2 K=RSA  A=RSA  E=3DES(168) M=MD5 
RC4-MD5              SSLv2 K=RSA  A=RSA  E=RC4(128)  M=MD5
</pre>
</blockquote>

<p>
As explained in the
<a href="http://www.modssl.org/docs/2.8/ssl_reference.html#ToC9">mod_ssl documentation</a>
<p>
<ul>
<li><code>K</code> means <em>Key Exchange Algorithm</em> (RSA or Diffie-Hellman variants).</li>
<li><code>A</code> means <em>Authentication Algorithm</em> (RSA, Diffie-Hellman, DSS or none).</li>
<li><code>E</code> means <em>Cipher/Encryption Algorithm</em> (DES, Triple-DES, RC4, RC2, IDEA or none).</li>
<li><code>M</code> means <em>MAC Digest Algorithm</em> (MD5, SHA or SHA1).</li>
</ul>


<p>
<strong>Conclusion</strong><br/>
The exclamation mark means that we request the SSL layer to remove a particular
algorithm or algorithms suite from the list of algorigthms to negotiate.
Here we took care to remove all algorithm combinations that have low or no encryption.
No encryption would defeat the purpose, wouldn't it? ;-)
</p>

]]>
    </content>
</entry>

<entry>
    <title>Authentication with X509 certificates</title>
    <link rel="alternate" type="text/html" href="http://www.singapore-security.com/2006/06/authentication_with_x509_certificates.html" />
    <id>tag:www.singapore-security.com,2006://1.8</id>

    <published>2006-06-10T07:50:34Z</published>
    <updated>2006-06-10T07:50:34Z</updated>

    <summary>Advantages and drawbacks of using X509 certificates as the main mode of authentication in an application
</summary>
    <author>
        <name>Fabrice A. Marie</name>
        <uri>http://www.singapore-security.com/about/fabrice</uri>
    </author>
    
        <category term="Application Security" />
    
    <content type="html" xml:lang="en" xml:base="http://www.singapore-security.com/">
        <![CDATA[<p>X509 certificates (a.k.a. SSL certificates) is often synonymous to <strong>strong security</strong>. What are their advantages and drawbacks?</p>]]>
        <![CDATA[<p>
While religion is totally irrelevant in security, this quote is fun nonetheless:
</p>
<blockquote>
<img src="/images/openq.png" alt="'" width="15" height="20" align="bottom" />
In God we trust<br/>
Everyone else must have an X.509 certificate.
<img src="/images/closeq.png" alt="'" width="15" height="20" align="bottom" />
</blockquote>


<p>
<strong>Intro</strong><br/>
Secure applications use HTTPS for transport to ensure privacy and integrity.
SSL used in HTTPS encrypts and signs all communication between the client
and the server.
</p>

<p>
In a classic HTTPS connection, the client verifies the authenticity of the server
<a href="http://en.wikipedia.org/wiki/X.509">X509 certificate</a> (a.k.a. SSL Certificate)
by ensuring that all the signatures in the "chain of trust" are
valid and all the signer's certificates are trusted.
This step is simply to ensure that the server is really
who it claims to be. What we are going to discuss is the
use of the same method to authenticate the client.
</p>

<p>
It's not new, it has been there for
as long as SSL exists in fact. It's just that very few people use it, or know how it works.
Some choose not to use it because of the drawbacks.
</p>

<p>
<strong>How does it work?</strong><br/>
An SSL session always, like all polite protocol conversations,
begins with formal introductions (think of it as an exchange of name-cards...).
The process is called an SSL handshake.
</p>

<p>
The SSL handshake allows the server to "present" itself (authenticate itself)
to the client by using public-key techniques.
The client and server then cooperate in creating symmetric keys
that will be used for encryption, decryption, and integrity validation during the SSL
session that follows. The SSL handshake also allows the client to authenticate itself to the server,
which is the part that interests us really.
</p>

<p>
There is no need to explain in details how it works when others do it so well...
A regular SSL handshake involves the server authenticating itself to the client,
while the client does not authenticate itself to the server. A detailed explanation
along with schematics can be found
<a href="http://publib.boulder.ibm.com/infocenter/tpfhelp/current/topic/com.ibm.ztpf.doc_put.02/gtps5/gtps5m0h.htm#HDRS5HAND1">here</a>
</p>

<p>
The SSL server can be configured to request authentication of the client,
in which case the client has to send a certificate to be authenticated.
The same "chain of trust" verification will be performed.
So the SSL handshake with client authentication has a few additional steps.
Again, a detailed explanation can be found
<a href="http://publib.boulder.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=/com.ibm.ztpf.doc_put.02/gtps5/gtps5m0h.htm">here</a>
</p>

<p>
<strong>How is the actual user authentication done?</strong><br/>
You need to have a central in-house
<a href="http://en.wikipedia.org/wiki/Certificate_authority">certificate authority</a>.
You can use command-line tools like <code>openssl</code> or <code>CA.pl</code>
which are part of the <a href="http://www.openssl.org/">OpenSSL</a> package.
Or you can use <a href="http://pki.openca.org/">OpenCA PKI</a> software which
is designed just for that.
</p>

<p>
You have to
</p>
<ul>
<li>Generate a Certificate Authority keypair (key + certificate)</li>
<li>Get the users to generate their keypair (key + certificate signing request)</li>
<li>Sign each user's certificate using the Certificate Authority keypair</li>
</ul>

<p>
Now since the authentication of the client is performed by SSL as part of the handshake,
you don't need to authenticate the user further (of course you can if you want to).
In other words, either the client has a valid keypair (key and valid certificate signed
by your Certificate Authority) and he can connect. Or he doesn't have any, in which
case the SSL connection will fail at handshake time.
</p>

<p>
<strong>Smart Card</strong><br/>
The most secure way to go about this is to store your keypair on
a smart card. The private key remains on the smart card at all time,
while the public key (the certificate) can be installed in the browser,
or any other public key or certificate store.
</p>

<p>
This way, when you want to connect to the server, you have to have
your smartcard reader plugged-in and the card properly inserted before
you can even connect. The browser will pop-up a window asking you for your
smart card pin. Once the pin is entered, the SSL handshake can be done
properly.
</p>

<p>
Nowadays, online services requiring heavy security prefer to use USB
smart card + smart card reader devices. It looks like a regular USB mass storage
key, except that it's a smart card reader and smart card combined.
It's easier to carry, and you just have to install the driver for it to work.
</p>

<p>
<strong>Drawbacks</strong><br/>
Obviously, the main problem is that the user must have his certificate + key wherever
he roams.
</p>

<p>
Sometimes, some companies with ultra-strict security policies will force their
proxy to play man-in-the middle, so they can still intercept your SSL connections.
It will break the server SSL certificate authentication but you can still
choose to ignore your browser's warning.
This will break the SSL client certificate authentication too but the server will obviously
<strong>not</strong> ignore it and won't let you connect.
</p>

<p>
Finally, most of the integrated USB smart card reader + smart card dongles have no
driver for Linux, *BSD or Solaris.
</p>

<p>
<strong>Conclusion</strong><br/>
Although client certificates are more troublesome to set up than username and passwords,
they offer a lot more security and resistance to targeted attacks. While they are
inconvenient to the road-warriors users, they are perfect authentication tokens
for workstation-based employees.
</p>

]]>
    </content>
</entry>

<entry>
    <title>System partitions and security</title>
    <link rel="alternate" type="text/html" href="http://www.singapore-security.com/2006/06/system_partitions_and_security.html" />
    <id>tag:www.singapore-security.com,2006://1.9</id>

    <published>2006-05-31T16:00:38Z</published>
    <updated>2007-06-14T07:06:51Z</updated>

    <summary>Does partitioning your system really enhance your security? or does it give you a false assurance?
</summary>
    <author>
        <name>Fabrice A. Marie</name>
        <uri>http://www.singapore-security.com/about/fabrice</uri>
    </author>
    
        <category term="Unix Security" />
    
    <content type="html" xml:lang="en" xml:base="http://www.singapore-security.com/">
        <![CDATA[<p>
It is a common belief that allocating several partitions
on your system is a Good Practice especially when it comes
to security.
<br/><br/>
Is that really the case?
</p>]]>
        <![CDATA[<p>
For a long time (too long if you ask me),
people have been preaching that partitioning was good for security.
</p>

<p>
<strong>The "filesystem full" argument</strong>
</p>
<blockquote>
<img src="/images/openq.png" alt="'" width="15" height="20" align="bottom" />
If I use a separate partition for <code>/var/log</code>, when the log gets full
it will not DoS my machine
<img src="/images/closeq.png" alt="'" width="15" height="20" align="bottom" />
</blockquote>

<p>
Two problems here:
</p>
<ul>
<li>The log should never get full: use <a href="https://www.bigbiz.com/cgi-bin/manpage?8+logrotate">logrotate</a>, backup old logs and remove them from the working system. <strong>Review</strong> your logs regularly!!!</li>
<li>If the the log directory does get full there are two more problems:
<ul>
<li>programs will start crashing because they can't log anymore and they didn't expect that to happen,</li>
<li>It is very dangerous to run without keeping traces (a smart attacker may create a lot of fake noise in order to get your logs full prompting the system to stop logging, before carrying on the real attack which will be unrecorded due to lack of logs)</li>
</ul>
</li>
</ul>

<p>
Conclusion: creating a separate partition for <code>/var/log</code> is a false sense of security.
</p>

<p>
<strong>The "mount option" argument</strong>
</p>
<blockquote>
<img src="/images/openq.png" alt="'" width="15" height="20" align="bottom" />
I can mount <code>/tmp</code> with <code>nosuid</code> option and
<code>/usr</code> with <code>ro</code> (read-only) option.
<img src="/images/closeq.png" alt="'" width="15" height="20" align="bottom" />
</blockquote>


<p>
Mounting <code>/tmp</code> with <code>nosuid</code> is hardly a security enhancement.
The only interesting kind of suid files that are really interesting are suid-root files.
To create such a file you need to be root. If you are root already
(using an exploit payload or with a root-shell) you can very well
remount <code>/tmp</code> without the no-suid option...
</p>

<p>
Mounting <code>/usr</code> with <code>ro</code>
option is exactly the same false sense of security.
To write in <code>/usr</code> you need to be root to start with,
and if you already are, you can remount it without the restriction.
</p>

<p>
If you truly want to prevent non authorized users
(including an attacker who succeeded in getting a
rootshell on your system) to write to <code>/usr</code>
consider using the excellent <a href="http://www.rsbac.org/">RSBAC</a>,
a Linux implementation of Trusted Operating Systems security policies.
Obviously RSBAC allows you to do a great deal more than just that.
</p>

<p>
<strong>The "easier to upgrade" argument</strong>
</p>
<blockquote>
<img src="/images/openq.png" alt="'" width="15" height="20" align="bottom" />
If I use partitions for let's say the <code>/home</code> directory,
it is easier to upgrade my system.
<img src="/images/closeq.png" alt="'" width="15" height="20" align="bottom" />
</blockquote>

<p>
That is true only if you upgrade your system the Windows way:
<em>"Reformat and reinstall"</em>. Otherwise, any decent Linux distribution,
or any other decent Unix flavor will let you upgrade without ever
touching anything in <code>/home</code>
</p>

<p>
<strong>The problems of partitioning</strong>
</p>
<ul>
<li>Limited number of partitions: x86 systems let you create
a maximum of 4 primary partitions per disk. You can elect
to use extended partitions instead which themselves
allow you to create 4 partitions per extended partition.
The bottom line is that you have a limited number
of partitions, so use them wisely.</li>
<li>Partition full while others are free: if you have 10 megs
free in your <code>/boot</code> partition, that's 10 megs
that <code>/var/log</code> or any other directory cannot
use since it is on another partition. Some smartasses
thereafter use soft-link like
<code>/var/log/httpd</code> -&gt; <code>/boot/httpdlog</code>
but needless to say that these are ugly tricks.</li>
<li>Tinkering with the partition table: is very dangerous,
if you screw up your partition table, your system will be lost
(unless you do like me and keep a print-out of all your machines'
partition tables in a printed file so you can later re-layout and
restore the partition table by hand in case of a problem).</li>
</ul>

<p>
<strong>Conclusion</strong><br/>
Don't use partitions believing that it will tremendously
enhance your security: it will, but only ever so slightly.
Partitions are generally a pain when you're running out of space,
and today we don't really need partitions anymore with
filesystems that support very large partitions and all.
</p>

<p>
You have been warned...
</p>]]>
    </content>
</entry>

</feed>
