handouts/ho01.tex
author Christian Urban <urbanc@in.tum.de>
Sat, 09 Jun 2018 21:01:46 +0100
changeset 565 d58f8e3e78a5
parent 539 48e0c8b03ae5
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
     1
\documentclass{article}
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
\usepackage{../style}
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
     3
\usepackage{../langs}
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
     5
\lstset{language=JavaScript}
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
366
34a8f73b2c94 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 365
diff changeset
     7
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
\begin{document}
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
     9
\fnote{\copyright{} Christian Urban, King's College London, 2014, 2015, 2016}
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
518
e1fcfba63a31 updated
Christian Urban <urbanc@in.tum.de>
parents: 514
diff changeset
    11
% passwords at dropbox
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    12
% %https://blogs.dropbox.com/tech/2016/09/how-dropbox-securely-stores-your-passwords/
518
e1fcfba63a31 updated
Christian Urban <urbanc@in.tum.de>
parents: 514
diff changeset
    13
e1fcfba63a31 updated
Christian Urban <urbanc@in.tum.de>
parents: 514
diff changeset
    14
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    15
%Ross anderson https://youtu.be/FY2YKxBxOkg
453
5921eebd9add updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 450
diff changeset
    16
%http://www.scmagazineuk.com/amazon-launches-open-source-tls-implementation-s2n/article/424360/
431
4b53f83c070c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 383
diff changeset
    17
457
38ef1ef6082d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 455
diff changeset
    18
%Singapurs Behörden gehen offline
38ef1ef6082d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 455
diff changeset
    19
462
33dcbafb27ce updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 459
diff changeset
    20
% how to store passwords
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    21
% https://nakedsecurity.sophos.com/2013/11/20/serious-security-how-to-store-your-users-passwords-safely/
457
38ef1ef6082d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 455
diff changeset
    22
508
c7b690b17b1d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 463
diff changeset
    23
%hashes
c7b690b17b1d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 463
diff changeset
    24
%http://web.archive.org/web/20071226014140/http://www.cits.rub.de/MD5Collisions/
c7b690b17b1d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 463
diff changeset
    25
%https://blog.codinghorror.com/speed-hashing/
c7b690b17b1d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 463
diff changeset
    26
%https://blogs.dropbox.com/tech/2016/09/how-dropbox-securely-stores-your-passwords/
c7b690b17b1d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 463
diff changeset
    27
509
aa2a09b9823c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 508
diff changeset
    28
% Hello Kitty database stolen
aa2a09b9823c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 508
diff changeset
    29
% https://nakedsecurity.sophos.com/2017/01/10/stolen-details-of-3-3m-hello-kitty-fans-including-kids-published-online/
aa2a09b9823c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 508
diff changeset
    30
%
aa2a09b9823c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 508
diff changeset
    31
aa2a09b9823c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 508
diff changeset
    32
% IoT
aa2a09b9823c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 508
diff changeset
    33
% https://nakedsecurity.sophos.com/2015/10/26/the-internet-of-things-stop-the-things-i-want-to-get-off/
aa2a09b9823c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 508
diff changeset
    34
514
a118052cf1d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 509
diff changeset
    35
% cloning creditc cards and passports
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    36
% https://www.youtube.com/watch?v=-4_on9zj-zs
514
a118052cf1d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 509
diff changeset
    37
a118052cf1d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 509
diff changeset
    38
167
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 160
diff changeset
    39
\section*{Handout 1 (Security Engineering)}
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    41
Much of the material and inspiration in this module is taken from the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    42
works of Bruce Schneier, Ross Anderson and Alex Halderman. I think they
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    43
are the world experts in the area of security engineering. I especially
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    44
like that they argue that a security engineer requires a certain
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    45
\emph{security mindset}. Bruce Schneier for example writes:
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
\begin{quote} 
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    48
\it ``Security engineers --- at least the good ones --- see the world
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    49
differently. They can't walk into a store without noticing how they
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    50
might shoplift. They can't use a computer without wondering about the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    51
security vulnerabilities. They can't vote without trying to figure out
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    52
how to vote twice. They just can't help it.''
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    53
\end{quote}
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    54
443
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
    55
\noindent
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
    56
and
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
    57
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    58
\begin{quote}
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    59
\it ``Security engineering\ldots requires you to think differently. You
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    60
need to figure out not how something works, but how something can be
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    61
made to not work. You have to imagine an intelligent and malicious
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    62
adversary inside your system \ldots, constantly trying new ways to
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    63
subvert it. You have to consider all the ways your system can fail, most
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    64
of them having nothing to do with the design itself. You have to look at
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    65
everything backwards, upside down, and sideways. You have to think like
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    66
an alien.''
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    67
\end{quote}
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    68
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    69
\noindent In this module I like to teach you this security mindset. This
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    70
might be a mindset that you think is very foreign to you---after all we
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    71
are all good citizens and do not hack into things. However, I beg to
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    72
differ: You have this mindset already when in school you were thinking,
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    73
at least hypothetically, about ways in which you can cheat in an exam
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    74
(whether it is by hiding notes or by looking over the shoulders of your
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    75
fellow pupils). Right? To defend a system, you need to have this kind of
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    76
mindset and be able to think like an attacker. This will include
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    77
understanding techniques that can be used to compromise security and
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    78
privacy in systems. This will many times result in insights where
443
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
    79
well-intended security mechanisms made a system actually less
184
55968b3205cc updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 183
diff changeset
    80
secure.\medskip
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    81
184
55968b3205cc updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 183
diff changeset
    82
\noindent 
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    83
{\Large\bf Warning!} However, don’t be evil! Using those techniques in
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    84
the real world may violate the law or King’s rules, and it may be
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    85
unethical. Under some circumstances, even probing for weaknesses of a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    86
system may result in severe penalties, up to and including expulsion,
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    87
fines and jail time. Acting lawfully and ethically is your
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    88
responsibility. Ethics requires you to refrain from doing harm. Always
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    89
respect privacy and rights of others. Do not tamper with any of King's
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    90
systems. If you try out a technique, always make doubly sure you are
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    91
working in a safe environment so that you cannot cause any harm, not
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    92
even accidentally. Don't be evil. Be an ethical hacker.\medskip
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    93
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    94
\noindent In this lecture I want to make you familiar with the security
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    95
mindset and dispel the myth that encryption is the answer to all
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    96
security problems (it is certainly often a part of an answer, but almost
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    97
always never a sufficient one). This is actually an important thread
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    98
going through the whole course: We will assume that encryption works
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
    99
perfectly, but still attack ``things''. By ``works perfectly'' we mean
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   100
that we will assume encryption is a black box and, for example, will not
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   101
look at the underlying mathematics and break the
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   102
algorithms.\footnote{Though fascinating this might be.}
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   103
 
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   104
For a secure system, it seems, four requirements need to come together:
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   105
First a security policy (what is supposed to be achieved?); second a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   106
mechanism (cipher, access controls, tamper resistance etc); third the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   107
assurance we obtain from the mechanism (the amount of reliance we can
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   108
put on the mechanism) and finally the incentives (the motive that the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   109
people guarding and maintaining the system have to do their job
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   110
properly, and also the motive that the attackers have to try to defeat
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   111
your policy). The last point is often overlooked, but plays an important
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   112
role. To illustrate this let's look at an example. 
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   113
446
64c20ed7941a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 445
diff changeset
   114
\subsubsection*{Chip-and-PIN is Surely More Secure, No?}
180
a95782c2f046 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 179
diff changeset
   115
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   116
The questions is whether the Chip-and-PIN system used with modern credit
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   117
cards is more secure than the older method of signing receipts at the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   118
till? On first glance the answer seems obvious: Chip-and-PIN must be
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   119
more secure and indeed improved security was the central plank in the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   120
``marketing speak'' of the banks behind Chip-and-PIN. The earlier system
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   121
was based on a magnetic stripe or a mechanical imprint on the cards and
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   122
required customers to sign receipts at the till whenever they bought
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   123
something. This signature authorised the transactions. Although in use
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   124
for a long time, this system had some crucial security flaws, including
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   125
making clones of credit cards and forging signatures. 
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   126
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   127
Chip-and-PIN, as the name suggests, relies on data being stored on a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   128
chip on the card and a PIN number for authorisation. Even though the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   129
banks involved trumpeted their system as being absolutely secure and
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   130
indeed fraud rates initially went down, security researchers were not
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   131
convinced (especially not the group around Ross
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   132
Anderson).\footnote{Actually, historical data about fraud showed that
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   133
first fraud rates went up (while early problems to do with the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   134
introduction of Chip-and-PIN we exploited), then down, but recently up
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   135
again (because criminals getting more familiar with the technology and
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   136
how it can be exploited).} To begin with, the Chip-and-PIN system
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   137
introduced a ``new player'' into the system that needed to be trusted:
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   138
the PIN terminals and their manufacturers. It was claimed that these
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   139
terminals were tamper-resistant, but needless to say this was a weak
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   140
link in the system, which criminals successfully attacked. Some
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   141
terminals were even so skilfully manipulated that they transmitted
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   142
skimmed PIN numbers via built-in mobile phone connections. To mitigate
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   143
this flaw in the security of Chip-and-PIN, you need to be able to vet
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   144
quite closely the supply chain of such terminals. This is something that
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   145
is mostly beyond the control of customers who need to use these
446
64c20ed7941a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 445
diff changeset
   146
terminals. 
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   147
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   148
To make matters worse for Chip-and-PIN, around 2009 Ross Anderson and
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   149
his group were able to perform man-in-the-middle attacks against
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   150
Chip-and-PIN. Essentially they made the terminal think the correct PIN
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   151
was entered and the card think that a signature was used. This is a kind
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   152
of \emph{protocol failure}. After discovery, the flaw was mitigated by
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   153
requiring that a link between the card and the bank is established at
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   154
every time the card is used. Even later this group found another problem
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   155
with Chip-and-PIN and ATMs which did not generate random enough numbers
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   156
(cryptographic nonces) on which the security of the underlying protocols
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   157
relies. 
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   158
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   159
The overarching problem with all this is that the banks who introduced
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   160
Chip-and-PIN managed with the new system to shift the liability for any
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   161
fraud and the burden of proof onto the customer. In the old system, the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   162
banks had to prove that the customer used the card, which they often did
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   163
not bother with. In effect, if fraud occurred the customers were either
381
036a762b02cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 379
diff changeset
   164
refunded fully or lost only a small amount of money. This
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   165
taking-responsibility-of-potential-fraud was part of the ``business
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   166
plan'' of the banks and did not reduce their profits too much.
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   167
177
46e581d66f3a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 176
diff changeset
   168
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   169
Since banks managed to successfully claim that their Chip-and-PIN system
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   170
is secure, they were under the new system able to point the finger at
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   171
the customer when fraud occurred: customers must have been negligent
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   172
losing their PIN and customers had almost no way of defending themselves
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   173
in such situations. That is why the work of \emph{ethical} hackers like
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   174
Ross Anderson's group is so important, because they and others
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   175
established that the banks' claim that their system is secure and it
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   176
must have been the customer's fault, was bogus. In 2009 the law changed
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   177
and the burden of proof went back to the banks. They need to prove
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   178
whether it was really the customer who used a card or not. The current
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   179
state of affairs, however, is that standing up for your right requires
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   180
you to be knowledgeable, potentially having to go to court\ldots{}if
446
64c20ed7941a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 445
diff changeset
   181
not, the banks are happy to take advantage of you.
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   182
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   183
This is a classic example where a fundamental security design principle
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   184
was violated: Namely, the one who is in the position to improve
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   185
security, also needs to bear the financial losses if things go wrong.
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   186
Otherwise, you end up with an insecure system. In case of the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   187
Chip-and-PIN system, no good security engineer would dare to claim that
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   188
it is secure beyond reproach: the specification of the EMV protocol
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   189
(underlying Chip-and-PIN) is some 700 pages long, but still leaves out
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   190
many things (like how to implement a good random number generator). No
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   191
human being is able to scrutinise such a specification and ensure it
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   192
contains no flaws. Moreover, banks can add their own sub-protocols to
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   193
EMV. With all the experience we already have, it is as clear as day that
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   194
criminals were bound to eventually be able to poke holes into it and
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   195
measures need to be taken to address them. However, with how the system
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   196
was set up, the banks had no real incentive to come up with a system
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   197
that is really secure. Getting the incentives right in favour of
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   198
security is often a tricky business. From a customer point of view, the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   199
Chip-and-PIN system was much less secure than the old signature-based
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   200
method. The customer could now lose significant amounts of money.
173
9126c13a7d93 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 169
diff changeset
   201
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   202
If you want to watch an entertaining talk about attacking Chip-and-PIN
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   203
cards, then this talk from the 2014 Chaos Computer Club conference is
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   204
for you:
445
9ad6445a0354 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 443
diff changeset
   205
9ad6445a0354 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 443
diff changeset
   206
\begin{center}
529
9b01bb695b22 updated
Christian Urban <urbanc@in.tum.de>
parents: 518
diff changeset
   207
\url{https://goo.gl/zuwVHb}
445
9ad6445a0354 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 443
diff changeset
   208
\end{center}
9ad6445a0354 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 443
diff changeset
   209
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   210
\noindent They claim that they are able to clone Chip-and-PINs cards
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   211
such that they get all data that was on the Magstripe, except for three
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   212
digits (the CVV number). Remember, Chip-and-PIN cards were introduced
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   213
exactly for preventing this. Ross Anderson also talked about his
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   214
research at the BlackHat Conference in 2014:
445
9ad6445a0354 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 443
diff changeset
   215
450
f3d5e57ca00a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 446
diff changeset
   216
\begin{center}
f3d5e57ca00a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 446
diff changeset
   217
\url{https://www.youtube.com/watch?v=ET0MFkRorbo}
f3d5e57ca00a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 446
diff changeset
   218
\end{center}
445
9ad6445a0354 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 443
diff changeset
   219
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   220
\noindent An article about reverse-engineering a PIN-number skimmer is
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   221
at 
455
2d9e005100f4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 453
diff changeset
   222
2d9e005100f4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 453
diff changeset
   223
\begin{center}\small
2d9e005100f4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 453
diff changeset
   224
\url{https://trustfoundry.net/reverse-engineering-a-discovered-atm-skimmer/}
2d9e005100f4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 453
diff changeset
   225
\end{center}
2d9e005100f4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 453
diff changeset
   226
2d9e005100f4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 453
diff changeset
   227
\noindent
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   228
including a scary video of how a PIN-pad overlay is installed by some
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   229
crooks. 
455
2d9e005100f4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 453
diff changeset
   230
2d9e005100f4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 453
diff changeset
   231
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   232
\subsection*{Of Cookies and Salts}
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   233
355
619073c37649 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
   234
Let us look at another example which will help with understanding how
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   235
passwords should be verified and stored.  Imagine you need to develop a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   236
web-application that has the feature of recording how many times a
355
619073c37649 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
   237
customer visits a page.  For example in order to give a discount
619073c37649 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
   238
whenever the customer has visited a webpage some $x$ number of times
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   239
(say $x$ equals $5$). There is one more constraint: we want to store the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   240
information about the number of visits as a cookie on the browser. I
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   241
think, for a number of years the webpage of the New York Times operated
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   242
in this way: it allowed you to read ten articles per month for free; if
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   243
you wanted to read more, you had to pay. My best guess is that it used
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   244
cookies for recording how many times their pages was visited, because if
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   245
I switched browsers I could easily circumvent the restriction about ten
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   246
articles.\footnote{Another online media that works in this way is the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   247
Times Higher Education \url{http://www.timeshighereducation.co.uk}. It
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   248
also seems to use cookies to restrict the number of free articles to
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   249
five.}
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   250
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   251
To implement our web-application it is good to look under the hood what
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   252
happens when a webpage is displayed in a browser. A typical
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   253
web-application works as follows: The browser sends a GET request for a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   254
particular page to a server. The server answers this request with a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   255
webpage in HTML (for our purposes we can ignore the details about HTML).
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   256
A simple JavaScript program that realises a server answering with a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   257
``Hello World'' webpage is as follows:
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   258
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   259
\begin{center}
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   260
\lstinputlisting{../progs/ap0.js}
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   261
\end{center}
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   262
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   263
\noindent The interesting lines are 4 to 7 where the answer to the GET
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   264
request is generated\ldots in this case it is just a simple string. This
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   265
program is run on the server and will be executed whenever a browser
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   266
initiates such a GET request. You can run this program on your computer
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   267
and then direct a browser to the address \pcode{localhost:8000} in order
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   268
to simulate a request over the internet. You are encouraged to try this
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   269
out\ldots{}theory is always good, but practice is better.
180
a95782c2f046 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 179
diff changeset
   270
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   271
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   272
For our web-application of interest is the feature that the server when
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   273
answering the request can store some information on the client's side.
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   274
This information is called a \emph{cookie}. The next time the browser
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   275
makes another GET request to the same webpage, this cookie can be read
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   276
again by the server. We can use cookies in order to store a counter that
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   277
records the number of times our webpage has been visited. This can be
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   278
realised with the following small program
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   279
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   280
\begin{center}
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   281
\lstinputlisting{../progs/ap2.js}
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   282
\end{center}
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   283
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   284
\noindent The overall structure of this program is the same as the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   285
earlier one: Lines 7 to 17 generate the answer to a GET-request. The new
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   286
part is in Line 8 where we read the cookie called \pcode{counter}. If
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   287
present, this cookie will be send together with the GET-request from the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   288
client. The value of this counter will come in form of a string,
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   289
therefore we use the function \pcode{parseInt} in order to transform it
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   290
into an integer. In case the cookie is not present, we default the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   291
counter to zero. The odd looking construction \code{...|| 0} is
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   292
realising this defaulting in JavaScript. In Line 9 we increase the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   293
counter by one and store it back to the client (under the name
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   294
\pcode{counter}, since potentially more than one value could be stored).
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   295
In Lines 10 to 15 we test whether this counter is greater or equal than
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   296
5 and send accordingly a specially grafted message back to the client.
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   297
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   298
Let us step back and analyse this program from a security point of view.
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   299
We store a counter in plain text on the client's browser (which is not
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   300
under our control). Depending on this value we want to unlock a resource
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   301
(like a discount) when it reaches a threshold. If the client deletes the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   302
cookie, then the counter will just be reset to zero. This does not
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   303
bother us, because the purported discount will just not be granted. In
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   304
this way we do not lose any (hypothetical) money. What we need to be
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   305
concerned about is, however, when a client artificially increases this
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   306
counter without having visited our web-page. This is actually a trivial
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   307
task for a knowledgeable person, since there are convenient tools that
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   308
allow one to set a cookie to an arbitrary value, for example above our
180
a95782c2f046 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 179
diff changeset
   309
threshold for the discount. 
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   310
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   311
There seems to be no simple way to prevent this kind of tampering with
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   312
cookies, because the whole purpose of cookies is that they are stored on
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   313
the client's side, which from the the server's perspective is a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   314
potentially hostile environment. What we need to ensure is the integrity
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   315
of this counter in this hostile environment. We could think of
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   316
encrypting the counter. But this has two drawbacks to do with the keys
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   317
for encryption. If you use a single, global key for all the clients that
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   318
visit our site, then we risk that our whole ``business'' might collapse
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   319
in the event this key gets known to the outside world. Then all cookies
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   320
we might have set in the past, can now be decrypted and manipulated. If,
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   321
on the other hand, we use many ``private'' keys for the clients, then we
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   322
have to solve the problem of having to securely store this key on our
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   323
server side (obviously we cannot store the key with the client because
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   324
then the client again has all data to tamper with the counter; and
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   325
obviously we also cannot encrypt the key, lest we can solve an
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   326
impossible chicken-and-egg problem). So encryption seems to not solve
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   327
the problem we face with the integrity of our counter.
169
2866fae8c1cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 168
diff changeset
   328
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   329
Fortunately, \emph{cryptographic hash functions} seem to be more
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   330
suitable for our purpose. Like encryption, hash functions scramble data
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   331
in such a way that it is easy to calculate the output of a hash function
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   332
from the input. But it is hard (i.e.~practically impossible) to
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   333
calculate the input from knowing the output. This is often called
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   334
\emph{preimage resistance}. Cryptographic hash functions also ensure
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   335
that given a message and a hash, it is computationally infeasible to
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   336
find another message with the same hash. This is called \emph{collusion
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   337
resistance}. Because of these properties, hash functions are often
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   338
called \emph{one-way functions}: you cannot go back from the output to
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   339
the input (without some tricks, see below). 
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 325
diff changeset
   340
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   341
There are several such hashing function. For example SHA-1 would hash
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   342
the string \pcode{"hello world"} to produce the hash-value
175
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   343
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   344
\begin{center}
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   345
\pcode{2aae6c35c94fcfb415dbe95f408b9ce91ee846ed}
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   346
\end{center}
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   347
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   348
\noindent Another handy feature of hash functions is that if the input
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   349
changes only a little, the output changes drastically. For example
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   350
\pcode{"iello world"} produces under SHA-1 the output
175
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   351
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   352
\begin{center}
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   353
\pcode{d2b1402d84e8bcef5ae18f828e43e7065b841ff1}
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   354
\end{center}
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   355
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   356
\noindent That means it is not predictable what the output will be from
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   357
just looking at input that is ``close by''. 
175
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   358
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   359
We can use hashes in our web-application and store in the cookie the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   360
value of the counter in plain text but together with its hash. We need
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   361
to store both pieces of data in such a way that we can extract them
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   362
again later on. In the code below I will just separate them using a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   363
\pcode{"-"}. For the counter \pcode{1} for example
184
55968b3205cc updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 183
diff changeset
   364
55968b3205cc updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 183
diff changeset
   365
\begin{center}
55968b3205cc updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 183
diff changeset
   366
\pcode{1-356a192b7913b04c54574d18c28d46e6395428ab}
55968b3205cc updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 183
diff changeset
   367
\end{center}
55968b3205cc updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 183
diff changeset
   368
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   369
\noindent If we now read back the cookie when the client visits our
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   370
webpage, we can extract the counter, hash it again and compare the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   371
result to the stored hash value inside the cookie. If these hashes
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   372
disagree, then we can deduce that the cookie has been tampered with.
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   373
Unfortunately, if they agree, we can still not be entirely sure that not
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   374
a clever hacker has tampered with the cookie. The reason is that the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   375
hacker can see the clear text part of the cookie, say \pcode{3}, and
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   376
also its hash. It does not take much trial and error to find out that we
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   377
used the SHA-1 hashing function and then the hacker can graft a cookie
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   378
accordingly. This is eased by the fact that for SHA-1 many strings and
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   379
corresponding hash-values are precalculated. Type, for example, into
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   380
Google the hash value for \pcode{"hello world"} and you will actually
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   381
pretty quickly find that it was generated by input string \pcode{"hello
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   382
world"}. Similarly for the hash-value for \pcode{1}. This defeats the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   383
purpose of a hashing function and thus would not help us with our
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   384
web-applications and later also not with how to store passwords
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   385
properly. 
175
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   386
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   387
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   388
There is one ingredient missing, which happens to be called
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   389
\emph{salts}. Salts are random keys, which are added to the counter
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   390
before the hash is calculated. In our case we must keep the salt secret.
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   391
As can be see in Figure~\ref{hashsalt}, we need to extract from the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   392
cookie the counter value and its hash (Lines 19 and 20). But before
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   393
hashing the counter again (Line 22) we need to add the secret salt.
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   394
Similarly, when we set the new increased counter, we will need to add
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   395
the salt before hashing (this is done in Line 15). Our web-application
178
13c6bd6e3477 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 177
diff changeset
   396
will now store cookies like 
175
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   397
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   398
\begin{figure}[p]
178
13c6bd6e3477 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 177
diff changeset
   399
\lstinputlisting{../progs/App4.js}
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   400
\caption{A Node.js web-app that sets a cookie in the client's browser
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   401
for counting the number of visits to a page.\label{hashsalt}}
175
4ebc97e6fdf0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 174
diff changeset
   402
\end{figure}
169
2866fae8c1cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 168
diff changeset
   403
179
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   404
\begin{center}\tt
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   405
\begin{tabular}{l}
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   406
1 + salt - 8189effef4d4f7411f4153b13ff72546dd682c69\\
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   407
2 + salt - 1528375d5ceb7d71597053e6877cc570067a738f\\
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   408
3 + salt - d646e213d4f87e3971d9dd6d9f435840eb6a1c06\\
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   409
4 + salt - 5b9e85269e4461de0238a6bf463ed3f25778cbba\\
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   410
...\\
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   411
\end{tabular}
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   412
\end{center}
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   413
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   414
\noindent These hashes allow us to read and set the value of the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   415
counter, and also give us confidence that the counter has not been
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   416
tampered with. This of course depends on being able to keep the salt
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   417
secret. Once the salt is public, we better ignore all cookies and start
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   418
setting them again with a new salt.
179
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   419
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   420
There is an interesting and very subtle point to note with respect to
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   421
the 'New York Times' way of checking the number visits. Essentially they
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   422
have their `resource' unlocked at the beginning and lock it only when
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   423
the data in the cookie states that the allowed free number of visits are
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   424
up. As said before, this can be easily circumvented by just deleting the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   425
cookie or by switching the browser. This would mean the New York Times
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   426
will lose revenue whenever this kind of tampering occurs. The `quick
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   427
fix' to require that a cookie must always be present does not work,
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   428
because then this newspaper will cut off any new readers, or anyone who
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   429
gets a new computer. In contrast, our web-application has the resource
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   430
(discount) locked at the beginning and only unlocks it if the cookie
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   431
data says so. If the cookie is deleted, well then the resource just does
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   432
not get unlocked. No major harm will result to us. You can see: the same
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   433
security mechanism behaves rather differently depending on whether the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   434
``resource'' needs to be locked or unlocked. Apart from thinking about
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   435
the difference very carefully, I do not know of any good ``theory'' that
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   436
could help with solving such security intricacies in any other way.  
179
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   437
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   438
\subsection*{How to Store Passwords Properly?}
179
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   439
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   440
While admittedly quite silly, the simple web-application in the previous
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   441
section should help with the more important question of how passwords
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   442
should be verified and stored. It is unbelievable that nowadays systems
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   443
still do this with passwords in plain text. The idea behind such
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   444
plain-text passwords is of course that if the user typed in
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   445
\pcode{foobar} as password, we need to verify whether it matches with
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   446
the password that is already stored for this user in the system. Why not
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   447
doing this with plain-text passwords? Unfortunately doing this
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   448
verification in plain text is really a bad idea. Alas, evidence suggests
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   449
it is still a widespread practice. I leave you to think about why
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   450
verifying passwords in plain text is a bad idea.
181
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   451
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   452
Using hash functions, like in our web-application, we can do better.
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   453
They allow us to not having to store passwords in plain text for
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   454
verification whether a password matches or not. We can just hash the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   455
password and store the hash-value. And whenever the user types in a new
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   456
password, well then we hash it again and check whether the hash-values
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   457
agree. Just like in the web-application before.
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   458
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   459
Lets analyse what happens when a hacker gets hold of such a hashed
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   460
password database. That is the scenario we want to defend
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   461
against.\footnote{If we could assume our servers can never be broken
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   462
into, then storing passwords in plain text would be no problem. The
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   463
point, however, is that servers are never absolutely secure.} The hacker
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   464
has then a list of user names and associated hash-values, like 
181
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   465
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   466
\begin{center}
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   467
\pcode{urbanc:2aae6c35c94fcfb415dbe95f408b9ce91ee846ed}
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   468
\end{center}
179
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   469
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   470
\noindent For a beginner-level hacker this information is of no use. It
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   471
would not work to type in the hash value instead of the password,
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   472
because it will go through the hashing function again and then the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   473
resulting two hash-values will not match. One attack a hacker can try,
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   474
however, is called a \emph{brute force attack}. Essentially this means
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   475
trying out exhaustively all strings
181
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   476
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   477
\begin{center}
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   478
\pcode{a}, \pcode{aa}, \pcode{...}, \pcode{ba}, \pcode{...},
181
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   479
\pcode{zzz},
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   480
\pcode{...}
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   481
\end{center}   
a736a0c324a3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 180
diff changeset
   482
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   483
\noindent and so on, hash them and check whether they match with the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   484
hash-values in the database. Such brute force attacks are surprisingly
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   485
effective. With modern technology (usually GPU graphic cards), passwords
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   486
of moderate length only need seconds or hours to be cracked. Well, the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   487
only defence we have against such brute force attacks is to make
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   488
passwords longer and force users to use the whole spectrum of letters
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   489
and keys for passwords. The hope is that this makes the search space too
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   490
big for an effective brute force attack.
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   491
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   492
Unfortunately, clever hackers have another ace up their sleeves. These
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   493
are called \emph{dictionary attacks}. The idea behind dictionary attack
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   494
is the observation that only few people are competent enough to use
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   495
sufficiently strong passwords. Most users (at least too many) use
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   496
passwords like
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   497
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   498
\begin{center}
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   499
\pcode{123456}, \pcode{password}, \pcode{qwerty}, \pcode{letmein},
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   500
\pcode{...}
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   501
\end{center}
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   502
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   503
\noindent So an attacker just needs to compile a list as large as
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   504
possible of such likely candidates of passwords and also compute their
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   505
hash-values. The difference between a brute force attack, where maybe
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   506
$2^{80}$ many strings need to be considered, is that a dictionary attack
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   507
might get away with checking only 10 Million words (remember the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   508
language English ``only'' contains 600,000 words). This is a drastic
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   509
simplification for attackers. Now, if the attacker knows the hash-value
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   510
of a password is
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   511
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   512
\begin{center}
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   513
\pcode{5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8}
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   514
\end{center}
179
1cacbe5c67cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 178
diff changeset
   515
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   516
\noindent then just a lookup in the dictionary will reveal that the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   517
plain-text password was \pcode{password}. What is good about this attack
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   518
is that the dictionary can be precompiled in the ``comfort of the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   519
hacker's home'' before an actual attack is launched. It just needs
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   520
sufficient storage space, which nowadays is pretty cheap. A hacker might
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   521
in this way not be able to crack all passwords in our database, but even
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   522
being able to crack 50\% can be serious damage for a large company
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   523
(because then you have to think about how to make users to change their
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   524
old passwords---a major hassle). And hackers are very industrious in
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   525
compiling these dictionaries: for example they definitely include
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   526
variations like \pcode{passw0rd} and also include rules that cover cases
227
7807863c4196 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 186
diff changeset
   527
like \pcode{passwordpassword} or \pcode{drowssap} (password
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   528
reversed).\footnote{Some entertaining rules for creating effective
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   529
dictionaries are described in the book ``Applied Cryptography'' by Bruce
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   530
Schneier (in case you can find it in the library), and also in the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   531
original research literature which can be accessed for free from
227
7807863c4196 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 186
diff changeset
   532
\url{http://www.klein.com/dvk/publications/passwd.pdf}.}
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   533
Historically, compiling a list for a dictionary attack is not as simple
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   534
as it might seem. At the beginning only ``real'' dictionaries were
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   535
available (like the Oxford English Dictionary), but such dictionaries
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   536
are not optimised for the purpose of cracking passwords. The first real
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   537
hard data about actually used passwords was obtained when a company
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   538
called RockYou ``lost'' at the end of 2009 32 Million plain-text
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   539
passwords. With this data of real-life passwords, dictionary attacks
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   540
took off. Compiling such dictionaries is nowadays very easy with the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   541
help of off-the-shelf tools.
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   542
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   543
These dictionary attacks can be prevented by using salts. Remember a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   544
hacker needs to use the most likely candidates of passwords and
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   545
calculate their hash-value. If we add before hashing a password a random
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   546
salt, like \pcode{mPX2aq}, then the string \pcode{passwordmPX2aq} will
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   547
almost certainly not be in the dictionary. Like in the web-application
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   548
in the previous section, a salt does not prevent us from verifying a
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   549
password. We just need to add the salt whenever the password is typed in
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   550
again. 
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   551
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   552
There is a question whether we should use a single random salt for every
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   553
password in our database. A single salt would already make dictionary
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   554
attacks considerably more difficult. It turns out, however, that in case
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   555
of password databases every password should get their own salt. This
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   556
salt is generated at the time when the password is first set. If you
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   557
look at a Unix password file you will find entries like
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   558
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   559
\begin{center}
288
fd4bf1a2d38d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 263
diff changeset
   560
\pcode{urbanc:$6$3WWbKfr1$4vblknvGr6FcDeF92R5xFn3mskfdnEn...$...}
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   561
\end{center}
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   562
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   563
\noindent where the first part is the login-name, followed by a field
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   564
\pcode{$6$} which specifies which hash-function is used. After that
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   565
follows the salt \pcode{3WWbKfr1} and after that the hash-value that is
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   566
stored for the password (which includes the salt). I leave it to you to
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   567
figure out how the password verification would need to work based on
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   568
this data.
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   569
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   570
There is a non-obvious benefit of using a separate salt for each
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   571
password. Recall that \pcode{123456} is a popular password that is most
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   572
likely used by several of your users (especially if the database
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   573
contains millions of entries). If we use no salt or one global salt, all
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   574
hash-values will be the same for this password. So if a hacker is in the
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   575
business of cracking as many passwords as possible, then it is a good
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   576
idea to concentrate on those very popular passwords. This is not
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   577
possible if each password gets its own salt: since we assume the salt is
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   578
generated randomly, each version of \pcode{123456} will be associated
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   579
with a different hash-value. This will make the life harder for an
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   580
attacker.
182
681e35f6b0e4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 181
diff changeset
   581
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   582
Note another interesting point. The web-application from the previous
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   583
section was only secure when the salt was secret. In the password case,
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   584
this is not needed. The salt can be public as shown above in the Unix
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   585
password file where it is actually stored as part of the password entry.
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   586
Knowing the salt does not give the attacker any advantage, but prevents
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   587
that dictionaries can be precompiled. While salts do not solve every
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   588
problem, they help with protecting against dictionary attacks on
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   589
password files. It protects people who have the same passwords on
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   590
multiple machines. But it does not protect against a focused attack
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   591
against a single password and also does not make poorly chosen passwords
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   592
any better. Still the moral is that you should never store passwords in
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   593
plain text. Never ever.
262
57269d9931da updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 227
diff changeset
   594
57269d9931da updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 227
diff changeset
   595
\subsubsection*{Further Reading}
174
e2180cead443 updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 173
diff changeset
   596
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   597
A readable article by Bruce Schneier on ``How Security Companies Sucker
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   598
Us with Lemons''
312
c913fe9bfd59 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 291
diff changeset
   599
c913fe9bfd59 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 291
diff changeset
   600
\begin{center}
c913fe9bfd59 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 291
diff changeset
   601
\url{http://archive.wired.com/politics/security/commentary/securitymatters/2007/04/securitymatters_0419}
c913fe9bfd59 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 291
diff changeset
   602
\end{center}
c913fe9bfd59 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 291
diff changeset
   603
c913fe9bfd59 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 291
diff changeset
   604
\noindent
443
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   605
A recent research paper about surveillance using cookies is
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   606
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   607
\begin{center}
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   608
\url{http://randomwalker.info/publications/cookie-surveillance-v2.pdf}
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   609
\end{center}
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   610
67d7d239c617 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 431
diff changeset
   611
\noindent
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   612
A slightly different point of view about the economies of password
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   613
cracking:
288
fd4bf1a2d38d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 263
diff changeset
   614
fd4bf1a2d38d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 263
diff changeset
   615
\begin{center}
325
48c6751f2173 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 312
diff changeset
   616
\url{http://xkcd.com/538/}
288
fd4bf1a2d38d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 263
diff changeset
   617
\end{center}
fd4bf1a2d38d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 263
diff changeset
   618
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   619
\noindent If you want to know more about passwords, the book by Bruce
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   620
Schneier about Applied Cryptography is recommendable, though quite
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   621
expensive. There is also another expensive book about penetration
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   622
testing, but the readable chapter about password attacks (Chapter 9) is
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   623
free:
262
57269d9931da updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 227
diff changeset
   624
57269d9931da updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 227
diff changeset
   625
\begin{center}
57269d9931da updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 227
diff changeset
   626
\url{http://www.nostarch.com/pentesting}
57269d9931da updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 227
diff changeset
   627
\end{center}
57269d9931da updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 227
diff changeset
   628
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   629
\noindent Even the government recently handed out some advice about
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   630
passwords
379
11f5f86bf956 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 370
diff changeset
   631
11f5f86bf956 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 370
diff changeset
   632
\begin{center}
11f5f86bf956 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 370
diff changeset
   633
\url{http://goo.gl/dIzqMg}
11f5f86bf956 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 370
diff changeset
   634
\end{center}
11f5f86bf956 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 370
diff changeset
   635
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   636
\noindent Here is an interesting blog-post about how a group ``cracked''
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   637
efficiently millions of bcrypt passwords from the Ashley Madison leak.
381
036a762b02cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 379
diff changeset
   638
036a762b02cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 379
diff changeset
   639
\begin{center}
036a762b02cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 379
diff changeset
   640
\url{http://goo.gl/83Ho0N}
036a762b02cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 379
diff changeset
   641
\end{center}
036a762b02cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 379
diff changeset
   642
459
514485146641 updated home works
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 457
diff changeset
   643
\noindent Or the passwords from eHarmony
514485146641 updated home works
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 457
diff changeset
   644
514485146641 updated home works
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 457
diff changeset
   645
\begin{center}
514485146641 updated home works
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 457
diff changeset
   646
\url{https://goo.gl/W63Xhw}
514485146641 updated home works
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 457
diff changeset
   647
\end{center}
514485146641 updated home works
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 457
diff changeset
   648
514485146641 updated home works
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 457
diff changeset
   649
\noindent The attack used dictionaries with up to 15 Billion
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   650
entries.\footnote{Compare this with the full brute-force space of
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   651
$62^8$} If eHarmony had properly salted their passwords, the attack
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   652
would have taken 31 years.
459
514485146641 updated home works
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 457
diff changeset
   653
514485146641 updated home works
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 457
diff changeset
   654
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   655
Clearly, passwords are a technology that comes to the end of its
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   656
usefulness, because brute force attacks become more and more powerful
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   657
and it is unlikely that humans get any better in remembering (securely)
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   658
longer and longer passwords. The big question is which technology can
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   659
replace passwords\ldots 
358
8787c16bc26e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
   660
\medskip
8787c16bc26e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
   661
288
fd4bf1a2d38d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 263
diff changeset
   662
fd4bf1a2d38d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 263
diff changeset
   663
\end{document}
fd4bf1a2d38d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 263
diff changeset
   664
370
ddac52c0014c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   665
%%% fingerprints  vs. passwords (what is better)
ddac52c0014c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   666
https://www.youtube.com/watch?v=VVxL9ymiyAU&feature=youtu.be
ddac52c0014c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   667
ddac52c0014c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   668
%%% cookies
ddac52c0014c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 366
diff changeset
   669
http://randomwalker.info/publications/cookie-surveillance-v2.pdf
288
fd4bf1a2d38d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 263
diff changeset
   670
158
702fea7754eb added handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   671
565
d58f8e3e78a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 539
diff changeset
   672
%%% Local Variables: %% mode: latex %% TeX-master: t %% End: