Web
Applica+on
Pentes+ng
Vivek
Ramachandran
SWSE,
SMFE,
SPSE,
SISE,
SLAE,
SGDE
Course
Instructor
Cer+fica+ons:
hGp://www.securitytube-‐training.com
Pentester
Academy:
hGp://www.PentesterAcademy.com
©SecurityTube.net
HTTP
Statelessness
and
Cookies
©SecurityTube.net
HTTP
is
Stateless
• Every
request
is
treated
independently
• Server
does
not
retain
state
for
clients
• What
does
this
mean?
– Every
request
needs
to
be
separately
authen+cated
– Every
request
MUST
carry
auth
informa+on
©SecurityTube.net
Cookies
• Allows
server
to
store
and
retrieve
data
from
the
client
• Typically
stored
in
a
file
on
the
client
side
• Text
only;
No
executable
code
• Cannot
exceed
4K
in
size
• Allows
for
retaining
state
with
the
Client’s
help
– Session
Management
– User
Preferences
©SecurityTube.net
How
does
a
Cookie
look?
©SecurityTube.net
How
is
a
Cookie
set
by
the
Server?
©SecurityTube.net
How
is
a
Cookie
sent
by
the
Client?
©SecurityTube.net
What
Informa+on
is
allowed
in
it?
Server
hGp://msdn.microsoZ.com/en-‐us/library/windows/desktop/aa384321(v=vs.85).aspx
Client
©SecurityTube.net
Cookie:
Name=Value
Pairs
Server
• E.g.
sessionID=ahj23hkhe32fd23j232ll2323ljk
• Mul+ple
separated
by
;
– E.g.
Name=vivek;
Age=12;
Country=India
©SecurityTube.net
Cookie:
expires
Server
• Session
Cookie
if
“expires”
not
men+oned
• Format:
– DAY,
DD-‐MMM-‐YYYY
HH:MM:SS
GMT
– Mon,
22-‐Nov-‐2013
22:45:00
GMT
• Max-‐Age
parameter
in
newer
RFC
6265
– Interval
in
seconds
aZer
receiving
the
cookie
©SecurityTube.net
Cookie:
domain
Server
• Domain
for
which
it
is
valid
• E.g.
– docs.securitytube.net
– .images.securitytube.net
©SecurityTube.net
Cookie:
path
Server
• Path
for
which
it
is
valid
• E.g.
– Sid1=asd;
Path=/;
– Sid2=xyz;
Path=/blog;
©SecurityTube.net
Cookie:
secure
Server
• Only
sent
over
HTTPS
©SecurityTube.net
Cookie:
hGponly
Server
• Cannot
be
accessed
by
Client
side
scripts
directly
• Cannot
be
scripted
using
Javascript
• XSS
mi+ga+on
mechanism
©SecurityTube.net
Pentester
Academy
©SecurityTube.net
TwiGer
and
Facebook
©SecurityTube.net