Data Encryption and Cryptographic Failures
Data Encryption and Cryptographic Failures
Data Encryption and Cryptographic Failures
Cryptographic Failures:
OWASP Top 10 #2
Data encryption is crucial to ensuring application security. In
this article, we will explore the vulnerabilities related to the lack
or absence of encryption through the prism of the OWASP Top
10. Using attack scenarios from penetration tests, we will
detail common exploits as well as best practices, fixes
and measures to implement to properly encrypt data in
order to prevent the risk of compromise.
Symmetric encryption
Symmetric encryption is an encryption method in which the
same key is used for both encryption and decryption. This key
is called the secret key and must be kept confidential for
security reasons.
Asymmetric encryption
Asymmetric encryption is an encryption method that uses two
different keys: a public key, which can be publicly distributed,
and a private key, which must remain confidential.
The best known tool for cracking passwords is John the ripper.
In our case, we will use it in wordlist mode with a password
dictionary: rockyou.txt.
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0MSIsIm5hbWUiOiJ2YWFkYXRhIHRlc3QgdX
NlciAxIiwicm9sZSI6Mn0.yo5wq8EOs96H5IHo3RGGMdaQjknLsRqNfwvneICyF14
When decoded from base 64, we get this:
{"alg":"HS256","typ":"JWT"}
{"id":"641","name":"vaadata test user 1","role":2}
+ signature
We can see that the JWT is signed with HS256 and that it
contains the id and role of the user in question. It is very likely
that if we manage to modify it, we can steal other accounts by
changing the id or escalate our privileges by changing the role.
We put the JWT in a file (jwt.txt) and try to crack it, first with a
dictionary and then, if that doesn’t work, we’ll try a pure brute
force attack.
It was quick. The key appears to be “secret”, presumably a
default key that has not been changed.