Which of the following security mechanisms provide integrity?
MAC
Digital signature
Public Key Cryptography
Symmetrical Cryptography
Solution
Integrity
means that the data is only changed when authorized / System behaves as expected.
Message integrity
means changes to the message during transmission are noticable to the recipient.
✅
Mandatory Access Control MAC
: is a type of access control - the subjects only have write access to files when authorized
✅
Message Authentication Code MAC
: The signature / encryption algorithm that generates a tag
Sig(k,m)=t
that only verifies the unmodified original message.
✅
Digital Signature
: Same as above but there is a private and public key - therefore we have message integrity and authentication.
❌
Public-Key-Encryption
: changes to message stay unnoticed
❌
Symmetric-Key-Encryption
: changes to message stay unnoticed
Let a cookie have the property
secure
- which requests does it get attached to?
Solution
Only attached to HTTPS requests (confidentiality)
Can not be set or overwritten by HTTP requests (integrity)
When is a process secure under the assumption that for it uses a secure password
p
a secure hashing function
h(p)
and a public database for authentication? (assuming the communication is encrypted)
h(p)
gets transfered and
h(p)
gets stored
p
gets transfered and
h(p)
gets stored
h(p)
gets transfered and
p
gets stored
p
gets transfered and
p
gets stored
Solution
Assuming were using a cryptographic protocol:
✅ (still vulnerable to offline dictionary attacks)
❌This is under the assumption that a reflection attack would be possible by intercepting and resending this message to
authenticate as an attacker
❌ because our database is public
❌ because our database is public
Which of the following are effective counter-measures against Cross-Site-Request-Forgery CSRF?
Anti-CSRF-Tokens in Forms
Referer Header validation
Custom HTTP-Headers
classic Cookie Authentification
Solution
Cross site request forgery CSRF
When the attacker triggers requests on the victims browser (that is authenticated on that website) through auto-submission of
forms or sources of resources that get fetched automatically when visiting the attackers website.
✅
Anti-CSRF-Tokens in Forms
contain a hidden value that gets sent with the request and gets validated by the request recipient
✅
Referer Header
in all requests. Contains the origin of the request. Effective but often accidentally suppressed by the network, browser,
…
✅
Custom HTTP-Headers = Cookie-to-header token
is a cookie with a randomly generated token is set upon the first visit of the web application then read by clients browser
and set as a custom header on further requests.
❌
classic Cookie Authentification
is useless
Which attacks does a stack canary prevent that sits between local variables and the return address pointer?
Solution
If we do not consider all the possibilities to bypass the canary, then it prevents overwriting
sfp
,
ret
, and the current functions arguments
funcp
.
Which attacks does the DEP prevent?
Solution
the execution of code on the stack - and thereby prevents code injections. (But can be bypassed through ret2libc, ROP, attacks
on memory mapping routine and heap possible, ...)
Which of the following are successful countermeasures against an SQL injection?
Detecting wheter
<script>
-Tags were used is enough
Whitelisting of allowed characters
Prepared Statements
Input validation (?)
Solution
❌ Script tags
✅ Whitelisting allowed characters
✅ prepared statements
✅ Broadly speaking - correct input validation would prevent it
A javascript script on the page
a.com/index.html
can do the following things: (Same Origin Policy)
Open the page
a.com/irgendwas.html
in another tab
Open the page
a.com/irgendwas.html
in another tab and edit the DOM
Open the page
b.com/irgendwas.html
in another tab
Open the page
b.com/irgendwas.html
in another tab and edit the DOM
Solution
(Not sure about opening another tab)
Javascript scripts can only read and write on
same-origin-resources
like the DOM.
One time pad OTP
What can an attacker learn in the following situations?
Messages
m1
and
m2
get encrypted with the same key
k
. An attacker knows this. What can the attacker learn about the messages?
Solution
c1=Enc(k,m1)=k⊕m1
c2=Enc(k,m2)=k⊕m2
c1⊕c2=m1⊕m2
which is vulnerable to frequency analysis.
Message
m
gets encrypted with
k
. The attacker knows the message and its cipher. What can he figure out about
k
?
Solution
c=k⊕m
c⊕k=m
Attacker knows
m
and
c
and can figure out the key based on that.
A message is 2 bits shorter than its key and therefore gets encrypted the following way:
c=OTP(01∣∣m,k)
where
01
stands for the bitwise concatenation.
Solution
If we just add 2 bits to the message so that it matches the length of the key, we change nothing about the security.