SlideShare una empresa de Scribd logo
1 de 28
Descargar para leer sin conexión
Security and Cryptography in Linux




EGLUG session presented by – Amr Ali
Key points

  What the word “hacker” means?
●

● Cryptography? You mean the username/password thing?

● Security is NOT Cryptography.

● Is there a security mindset?

● I'm not a gov agency, why should I care about security?

● Security through obscurity? Pffft .. yeah right.

● Linux way of applying security measures and practical

cryptography.
A hacker
Hacker (noun): Is an intelligent, talented, and
innovative person that have a combination of
skills that allows him/her to bring innovation to
reality.

A hacker could be, an inventor, a programmer
(mainly), a systems engineer, or anyone that could
think outside of the box and bring ideas and
solutions that are not present.
Cryptography, what?
Cryptography is not the username/password fields, this is called authentication,
in the other hand, cryptography is thee art of encryption, which turns plain text to
cipher text.

/* Authentication */
Username: Alice
Password: ******

/* Cryptography (Encryption) */
“I'm welling to pay you the agreed amount of money which is $2000.” --->
“AB76CD5E9F0F77D6A55E2A....”

As we can see encryption something really we don't see on daily bases if not at
all, because most of the time it is implemented to be transparent to the user.
Security is not cryptography!
Cryptography is a security field, not security it self.

A cryptographer: is a person that makes (en/de)cryption
algorithms to be implemented into a certain manner.

A security engineer: is a person that implements cryptographic
algorithms into applications.

The strongest part of any security system is cryptography,
however implementation might have weaknesses.
Security Minds
Being a security engineer is really not just a title and a high salary
job with a pile of certifications. NO!

It takes dedication and hard work to “develop” security aware
mind, for example ....

A security engineer would think if he could ...

  Shoplift at the mall while he's shopping, and how to exploit a
●

certain vulnerability in the system itself.
● Steal a car from the repair shop by knowing the car's owner last

name.
● Etc....
Security for everybody
Y'all might ask yourselves, why should I have
security measures in my company network or
home computer?

The answer is very simple, it is like giving out
your car's keys to a stranger, if you didn't protect
the key and the car, someone else going to make
use of them, and 99% of the time it is not going to
be in your best interest.
Security through obscurity
This security scheme of providing security by secrecy is proven to be
defunct for many reasons, despite the fact that it does not really make
your system any stronger, but rather weaker.

From an attacker point of view, if you are following this scheme, you are
basically making it harder to probe your system for security weaknesses,
however that exact measure gives a higher probability that there are
weaknesses in the system, which once found, your whole product
becomes vulnerable to that weakness and with time, exploitation is
inevitable.

The good way to go is to harden the security design itself so you don't
have to worry about reverse engineering, besides, it gives more
confidence to your future client, that he knows what exactly is happening.
The Linux Way
Linux gives us the freedom to apply cryptographic measures
without doing any coding at all. There are hundreds of tools
and resources Linux provides, we will have a look at them in
the following order ....

  /dev/random & /dev/urandom
●

● aespipe, loop-aes and dm-crypt (weaker due to design)

● Sha1sum, sha256sum, sha512sum, md5sum (INSECURE)
/dev/random & /dev/urandom
/dev/random: is a TRNG or a True Random Number Generator, it uses
different sources as entropy (e.g hardware clocks, network traffic,
etc...). This character device provides very high level of entropy,
however if the internal pool got exhausted, it blocks until more
environmental noise is available.

/dev/urandom: (“unlocked” random) is a CSPRNG or a
Cryptographically Secure Pseudo Random Number Generator, the big
difference here is that it reuses the pool after it gets exhausted, which
in return a bit less entropy in the output than its counter part
/dev/random.
aespipe, loop-aes & dm-crypt
aespipe: I guess its name explains its function pretty well, but it is basically an
application that you could pipe through plain-text data and get cipher-text data as
output, which in result makes it a very good handy tool in your cryptographic
collection.

Examples:
   ~# echo “Cryptos are fun” | aespipe -e aes256 -H sha512
   ~# mkisofs -r /home/d4de | aespipe -e aes196 -T > image.iso

As we can see in the first example, we just simply encrypted the phrase “Cryptos
are fun” with AES256 cipher and hashed the key with SHA512, simple enough?

Now if you are going after encrypting an ISO image file and then burn it to a
blank CD, so you would be asked for a password to be able to mount the CD;
this one line in the second example should do it for you.
aespipe, loop-aes & dm-crypt
loop-aes: Is just your normal loop device except it provides
encryption/decryption with the use of AES ciphers. As we speak loop-aes have
patches for kernels up to 2.6.27, however if you are going to use the bleeding
edge 2.6.28, I'm afraid that you are going to patch your kernel like I did myself.

dm-crypt: This is a weak alternative to loop-aes for those who want easy setup
for their encrypted partitions, I said this is weak but not insecure because of the
fact that it is actually hard to mount an attack on its design flaw but still feasible.
The flaw is that dm-crypt stores key information and other arguments in the first
block in the encrypted disk or partition, which makes it possible to identify the
cipher used in the encryption process with the possibility of extracting more
information from it.

Personally I took the effort of manually patching my kernel for loop-aes.
shaXsum and md5sum
Some of you might have heard about hashes before, they are implemented in
many ways nowadays, but the most known ones are checking against a password
by storing the computed hash for the password and compare it to the provided
password's computed hash.

SHA Family is a suite-b NSA cryptographic hashing algorithms, which are
pretty good compared to MD5 which is made by RSA Labs.

Examples:
   ~# echo “Cryptos are fun” | sha1sum
   ~# sha256sum /home/d4de/somefile -b

I meant to not give an example for MD5, because as of december 2008 at CCC
conference, a practical collision attack mounted successfully which caused to
forge and validate intermediate SSL certificates, in result most if not all CA's
changed their hash algorithms to SHA or some strong equivalent.
Final words
Please remember the following points ...

(1) A hacker is not a cracker.
(2) Security mindset is something you need to develop, not to “purchase”.
(3) Cryptography is NOT Security.
(4) A strong cryptographic cipher weakly implemented makes your “security”
vulnerable, but that does NOT mean that the cipher is weak.
(5) Hire a thief to teach you how to protect your car, do NOT hire a cop.

This presentation will be available at my website at (http://amr-ali.co.cc).
Security and Cryptography in Linux




EGLUG session presented by – Amr Ali
Key points

  What the word “hacker” means?
●

  Cryptography? You mean the username/password thing?
●

● Security is NOT Cryptography.

● Is there a security mindset?

● I'm not a gov agency, why should I care about security?

● Security through obscurity? Pffft .. yeah right.

● Linux way of applying security measures and practical

cryptography.
A hacker
Hacker (noun): Is an intelligent, talented, and
innovative person that have a combination of
skills that allows him/her to bring innovation to
reality.

A hacker could be, an inventor, a programmer
(mainly), a systems engineer, or anyone that could
think outside of the box and bring ideas and
solutions that are not present.
Cryptography, what?
Cryptography is not the username/password fields, this is called authentication,
in the other hand, cryptography is thee art of encryption, which turns plain text to
cipher text.

/* Authentication */
Username: Alice
Password: ******

/* Cryptography (Encryption) */
“I'm welling to pay you the agreed amount of money which is $2000.” --->
“AB76CD5E9F0F77D6A55E2A....”

As we can see encryption something really we don't see on daily bases if not at
all, because most of the time it is implemented to be transparent to the user.
Security is not cryptography!
Cryptography is a security field, not security it self.

A cryptographer: is a person that makes (en/de)cryption
algorithms to be implemented into a certain manner.

A security engineer: is a person that implements cryptographic
algorithms into applications.

The strongest part of any security system is cryptography,
however implementation might have weaknesses.
Security Minds
Being a security engineer is really not just a title and a high salary
job with a pile of certifications. NO!

It takes dedication and hard work to “develop” security aware
mind, for example ....

A security engineer would think if he could ...

  Shoplift at the mall while he's shopping, and how to exploit a
●

certain vulnerability in the system itself.
● Steal a car from the repair shop by knowing the car's owner last

name.
● Etc....
Security for everybody
Y'all might ask yourselves, why should I have
security measures in my company network or
home computer?

The answer is very simple, it is like giving out
your car's keys to a stranger, if you didn't protect
the key and the car, someone else going to make
use of them, and 99% of the time it is not going to
be in your best interest.
Security through obscurity
This security scheme of providing security by secrecy is proven to be
defunct for many reasons, despite the fact that it does not really make
your system any stronger, but rather weaker.

From an attacker point of view, if you are following this scheme, you are
basically making it harder to probe your system for security weaknesses,
however that exact measure gives a higher probability that there are
weaknesses in the system, which once found, your whole product
becomes vulnerable to that weakness and with time, exploitation is
inevitable.

The good way to go is to harden the security design itself so you don't
have to worry about reverse engineering, besides, it gives more
confidence to your future client, that he knows what exactly is happening.
The Linux Way
Linux gives us the freedom to apply cryptographic measures
without doing any coding at all. There are hundreds of tools
and resources Linux provides, we will have a look at them in
the following order ....

  /dev/random & /dev/urandom
●

  aespipe, loop-aes and dm-crypt (weaker due to design)
●

● Sha1sum, sha256sum, sha512sum, md5sum (INSECURE)
/dev/random & /dev/urandom
/dev/random: is a TRNG or a True Random Number Generator, it uses
different sources as entropy (e.g hardware clocks, network traffic,
etc...). This character device provides very high level of entropy,
however if the internal pool got exhausted, it blocks until more
environmental noise is available.

/dev/urandom: (“unlocked” random) is a CSPRNG or a
Cryptographically Secure Pseudo Random Number Generator, the big
difference here is that it reuses the pool after it gets exhausted, which
in return a bit less entropy in the output than its counter part
/dev/random.
aespipe, loop-aes & dm-crypt
aespipe: I guess its name explains its function pretty well, but it is basically an
application that you could pipe through plain-text data and get cipher-text data as
output, which in result makes it a very good handy tool in your cryptographic
collection.

Examples:
   ~# echo “Cryptos are fun” | aespipe -e aes256 -H sha512
   ~# mkisofs -r /home/d4de | aespipe -e aes196 -T > image.iso

As we can see in the first example, we just simply encrypted the phrase “Cryptos
are fun” with AES256 cipher and hashed the key with SHA512, simple enough?

Now if you are going after encrypting an ISO image file and then burn it to a
blank CD, so you would be asked for a password to be able to mount the CD;
this one line in the second example should do it for you.
aespipe, loop-aes & dm-crypt
loop-aes: Is just your normal loop device except it provides
encryption/decryption with the use of AES ciphers. As we speak loop-aes have
patches for kernels up to 2.6.27, however if you are going to use the bleeding
edge 2.6.28, I'm afraid that you are going to patch your kernel like I did myself.

dm-crypt: This is a weak alternative to loop-aes for those who want easy setup
for their encrypted partitions, I said this is weak but not insecure because of the
fact that it is actually hard to mount an attack on its design flaw but still feasible.
The flaw is that dm-crypt stores key information and other arguments in the first
block in the encrypted disk or partition, which makes it possible to identify the
cipher used in the encryption process with the possibility of extracting more
information from it.

Personally I took the effort of manually patching my kernel for loop-aes.
shaXsum and md5sum
Some of you might have heard about hashes before, they are implemented in
many ways nowadays, but the most known ones are checking against a password
by storing the computed hash for the password and compare it to the provided
password's computed hash.

SHA Family is a suite-b NSA cryptographic hashing algorithms, which are
pretty good compared to MD5 which is made by RSA Labs.

Examples:
   ~# echo “Cryptos are fun” | sha1sum
   ~# sha256sum /home/d4de/somefile -b

I meant to not give an example for MD5, because as of december 2008 at CCC
conference, a practical collision attack mounted successfully which caused to
forge and validate intermediate SSL certificates, in result most if not all CA's
changed their hash algorithms to SHA or some strong equivalent.
Final words
Please remember the following points ...

(1) A hacker is not a cracker.
(2) Security mindset is something you need to develop, not to “purchase”.
(3) Cryptography is NOT Security.
(4) A strong cryptographic cipher weakly implemented makes your “security”
vulnerable, but that does NOT mean that the cipher is weak.
(5) Hire a thief to teach you how to protect your car, do NOT hire a cop.

This presentation will be available at my website at (http://amr-ali.co.cc).

Más contenido relacionado

La actualidad más candente

La actualidad más candente (7)

Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
 
Shameful secrets of proprietary network protocols
Shameful secrets of proprietary network protocolsShameful secrets of proprietary network protocols
Shameful secrets of proprietary network protocols
 
HackInBo2k16 - Threat Intelligence and Malware Analysis
HackInBo2k16 - Threat Intelligence and Malware AnalysisHackInBo2k16 - Threat Intelligence and Malware Analysis
HackInBo2k16 - Threat Intelligence and Malware Analysis
 
Adversary Emulation using CALDERA
Adversary Emulation using CALDERAAdversary Emulation using CALDERA
Adversary Emulation using CALDERA
 
Stop expecting magic fairy dust: Make apps secure by design
Stop expecting magic fairy dust: Make apps secure by designStop expecting magic fairy dust: Make apps secure by design
Stop expecting magic fairy dust: Make apps secure by design
 
How to hide your browser 0-day @ Disobey
How to hide your browser 0-day @ DisobeyHow to hide your browser 0-day @ Disobey
How to hide your browser 0-day @ Disobey
 
Understanding the fundamentals of attacks
Understanding the fundamentals of attacksUnderstanding the fundamentals of attacks
Understanding the fundamentals of attacks
 

Destacado (6)

Linux security introduction
Linux security introduction Linux security introduction
Linux security introduction
 
Threats, Vulnerabilities & Security measures in Linux
Threats, Vulnerabilities & Security measures in LinuxThreats, Vulnerabilities & Security measures in Linux
Threats, Vulnerabilities & Security measures in Linux
 
Basic Linux Security
Basic Linux SecurityBasic Linux Security
Basic Linux Security
 
Linux Security Overview
Linux Security OverviewLinux Security Overview
Linux Security Overview
 
Linux Operating System Vulnerabilities
Linux Operating System VulnerabilitiesLinux Operating System Vulnerabilities
Linux Operating System Vulnerabilities
 
Security and Linux Security
Security and Linux SecuritySecurity and Linux Security
Security and Linux Security
 

Similar a Security & Cryptography In Linux

Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoid
Filip Šebesta
 
Reversing & malware analysis training part 8 malware memory forensics
Reversing & malware analysis training part 8   malware memory forensicsReversing & malware analysis training part 8   malware memory forensics
Reversing & malware analysis training part 8 malware memory forensics
Abdulrahman Bassam
 

Similar a Security & Cryptography In Linux (20)

How to be come a hacker slide for 2600 laos
How to be come a hacker slide for 2600 laosHow to be come a hacker slide for 2600 laos
How to be come a hacker slide for 2600 laos
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoid
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoid
 
HSM (Hardware Security Module)
HSM (Hardware Security Module)HSM (Hardware Security Module)
HSM (Hardware Security Module)
 
How to hide your browser 0-days
How to hide your browser 0-daysHow to hide your browser 0-days
How to hide your browser 0-days
 
Password hacking
Password hackingPassword hacking
Password hacking
 
Jsse
JsseJsse
Jsse
 
computer-security-and-cryptography-a-simple-presentation
computer-security-and-cryptography-a-simple-presentationcomputer-security-and-cryptography-a-simple-presentation
computer-security-and-cryptography-a-simple-presentation
 
Cryptography
CryptographyCryptography
Cryptography
 
The Emergent Cloud Security Toolchain for CI/CD
The Emergent Cloud Security Toolchain for CI/CDThe Emergent Cloud Security Toolchain for CI/CD
The Emergent Cloud Security Toolchain for CI/CD
 
The Emergent Cloud Security Toolchain for CI/CD
The Emergent Cloud Security Toolchain for CI/CDThe Emergent Cloud Security Toolchain for CI/CD
The Emergent Cloud Security Toolchain for CI/CD
 
DMA - Stupid Cyber Criminal Tricks
DMA - Stupid Cyber Criminal TricksDMA - Stupid Cyber Criminal Tricks
DMA - Stupid Cyber Criminal Tricks
 
Get started with hacking
Get started with hackingGet started with hacking
Get started with hacking
 
Information Security
Information SecurityInformation Security
Information Security
 
The DevSecOps Builder’s Guide to the CI/CD Pipeline
The DevSecOps Builder’s Guide to the CI/CD PipelineThe DevSecOps Builder’s Guide to the CI/CD Pipeline
The DevSecOps Builder’s Guide to the CI/CD Pipeline
 
Crypto workshop part 3 - Don't do this yourself
Crypto workshop part 3 - Don't do this yourselfCrypto workshop part 3 - Don't do this yourself
Crypto workshop part 3 - Don't do this yourself
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
 
Reversing & malware analysis training part 8 malware memory forensics
Reversing & malware analysis training part 8   malware memory forensicsReversing & malware analysis training part 8   malware memory forensics
Reversing & malware analysis training part 8 malware memory forensics
 
Drupal Camp Atlanta 2011 - Drupal Security
Drupal Camp Atlanta 2011 - Drupal SecurityDrupal Camp Atlanta 2011 - Drupal Security
Drupal Camp Atlanta 2011 - Drupal Security
 
Image and text Encryption using RSA algorithm in java
Image and text Encryption using RSA algorithm in java  Image and text Encryption using RSA algorithm in java
Image and text Encryption using RSA algorithm in java
 

Más de Ahmed Mekkawy

Virtualization Techniques & Cloud Compting
Virtualization Techniques & Cloud ComptingVirtualization Techniques & Cloud Compting
Virtualization Techniques & Cloud Compting
Ahmed Mekkawy
 
A look at computer security
A look at computer securityA look at computer security
A look at computer security
Ahmed Mekkawy
 
Networking in Gnu/Linux
Networking in Gnu/LinuxNetworking in Gnu/Linux
Networking in Gnu/Linux
Ahmed Mekkawy
 

Más de Ahmed Mekkawy (20)

Encrypted Traffic in Egypt - an attempt to understand
Encrypted Traffic in Egypt - an attempt to understandEncrypted Traffic in Egypt - an attempt to understand
Encrypted Traffic in Egypt - an attempt to understand
 
Securing Governmental Public Services with Free/Open Source Tools - Egyptian ...
Securing Governmental Public Services with Free/Open Source Tools - Egyptian ...Securing Governmental Public Services with Free/Open Source Tools - Egyptian ...
Securing Governmental Public Services with Free/Open Source Tools - Egyptian ...
 
OpenData for governments
OpenData for governmentsOpenData for governments
OpenData for governments
 
Infrastructure as a Code
Infrastructure as a Code Infrastructure as a Code
Infrastructure as a Code
 
شركة سبيرولا للأنظمة والجمعية المصرية للمصادر المفتوحة
شركة سبيرولا للأنظمة والجمعية المصرية للمصادر المفتوحةشركة سبيرولا للأنظمة والجمعية المصرية للمصادر المفتوحة
شركة سبيرولا للأنظمة والجمعية المصرية للمصادر المفتوحة
 
Everything is a Game
Everything is a GameEverything is a Game
Everything is a Game
 
Why Cloud Computing has to go the FOSS way
Why Cloud Computing has to go the FOSS wayWhy Cloud Computing has to go the FOSS way
Why Cloud Computing has to go the FOSS way
 
FOSS Enterpreneurship
FOSS EnterpreneurshipFOSS Enterpreneurship
FOSS Enterpreneurship
 
Intro to FOSS & using it in development
Intro to FOSS & using it in developmentIntro to FOSS & using it in development
Intro to FOSS & using it in development
 
FOSS, history and philosophy
FOSS, history and philosophyFOSS, history and philosophy
FOSS, history and philosophy
 
Virtualization Techniques & Cloud Compting
Virtualization Techniques & Cloud ComptingVirtualization Techniques & Cloud Compting
Virtualization Techniques & Cloud Compting
 
A look at computer security
A look at computer securityA look at computer security
A look at computer security
 
Networking in Gnu/Linux
Networking in Gnu/LinuxNetworking in Gnu/Linux
Networking in Gnu/Linux
 
Foss Movement In Egypt
Foss Movement In EgyptFoss Movement In Egypt
Foss Movement In Egypt
 
Sysprog17
Sysprog17Sysprog17
Sysprog17
 
Sysprog 15
Sysprog 15Sysprog 15
Sysprog 15
 
Sysprog 9
Sysprog 9Sysprog 9
Sysprog 9
 
Sysprog 12
Sysprog 12Sysprog 12
Sysprog 12
 
Sysprog 14
Sysprog 14Sysprog 14
Sysprog 14
 
Sysprog 11
Sysprog 11Sysprog 11
Sysprog 11
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Security & Cryptography In Linux

  • 1. Security and Cryptography in Linux EGLUG session presented by – Amr Ali
  • 2. Key points What the word “hacker” means? ● ● Cryptography? You mean the username/password thing? ● Security is NOT Cryptography. ● Is there a security mindset? ● I'm not a gov agency, why should I care about security? ● Security through obscurity? Pffft .. yeah right. ● Linux way of applying security measures and practical cryptography.
  • 3. A hacker Hacker (noun): Is an intelligent, talented, and innovative person that have a combination of skills that allows him/her to bring innovation to reality. A hacker could be, an inventor, a programmer (mainly), a systems engineer, or anyone that could think outside of the box and bring ideas and solutions that are not present.
  • 4. Cryptography, what? Cryptography is not the username/password fields, this is called authentication, in the other hand, cryptography is thee art of encryption, which turns plain text to cipher text. /* Authentication */ Username: Alice Password: ****** /* Cryptography (Encryption) */ “I'm welling to pay you the agreed amount of money which is $2000.” ---> “AB76CD5E9F0F77D6A55E2A....” As we can see encryption something really we don't see on daily bases if not at all, because most of the time it is implemented to be transparent to the user.
  • 5. Security is not cryptography! Cryptography is a security field, not security it self. A cryptographer: is a person that makes (en/de)cryption algorithms to be implemented into a certain manner. A security engineer: is a person that implements cryptographic algorithms into applications. The strongest part of any security system is cryptography, however implementation might have weaknesses.
  • 6. Security Minds Being a security engineer is really not just a title and a high salary job with a pile of certifications. NO! It takes dedication and hard work to “develop” security aware mind, for example .... A security engineer would think if he could ... Shoplift at the mall while he's shopping, and how to exploit a ● certain vulnerability in the system itself. ● Steal a car from the repair shop by knowing the car's owner last name. ● Etc....
  • 7. Security for everybody Y'all might ask yourselves, why should I have security measures in my company network or home computer? The answer is very simple, it is like giving out your car's keys to a stranger, if you didn't protect the key and the car, someone else going to make use of them, and 99% of the time it is not going to be in your best interest.
  • 8. Security through obscurity This security scheme of providing security by secrecy is proven to be defunct for many reasons, despite the fact that it does not really make your system any stronger, but rather weaker. From an attacker point of view, if you are following this scheme, you are basically making it harder to probe your system for security weaknesses, however that exact measure gives a higher probability that there are weaknesses in the system, which once found, your whole product becomes vulnerable to that weakness and with time, exploitation is inevitable. The good way to go is to harden the security design itself so you don't have to worry about reverse engineering, besides, it gives more confidence to your future client, that he knows what exactly is happening.
  • 9. The Linux Way Linux gives us the freedom to apply cryptographic measures without doing any coding at all. There are hundreds of tools and resources Linux provides, we will have a look at them in the following order .... /dev/random & /dev/urandom ● ● aespipe, loop-aes and dm-crypt (weaker due to design) ● Sha1sum, sha256sum, sha512sum, md5sum (INSECURE)
  • 10. /dev/random & /dev/urandom /dev/random: is a TRNG or a True Random Number Generator, it uses different sources as entropy (e.g hardware clocks, network traffic, etc...). This character device provides very high level of entropy, however if the internal pool got exhausted, it blocks until more environmental noise is available. /dev/urandom: (“unlocked” random) is a CSPRNG or a Cryptographically Secure Pseudo Random Number Generator, the big difference here is that it reuses the pool after it gets exhausted, which in return a bit less entropy in the output than its counter part /dev/random.
  • 11. aespipe, loop-aes & dm-crypt aespipe: I guess its name explains its function pretty well, but it is basically an application that you could pipe through plain-text data and get cipher-text data as output, which in result makes it a very good handy tool in your cryptographic collection. Examples: ~# echo “Cryptos are fun” | aespipe -e aes256 -H sha512 ~# mkisofs -r /home/d4de | aespipe -e aes196 -T > image.iso As we can see in the first example, we just simply encrypted the phrase “Cryptos are fun” with AES256 cipher and hashed the key with SHA512, simple enough? Now if you are going after encrypting an ISO image file and then burn it to a blank CD, so you would be asked for a password to be able to mount the CD; this one line in the second example should do it for you.
  • 12. aespipe, loop-aes & dm-crypt loop-aes: Is just your normal loop device except it provides encryption/decryption with the use of AES ciphers. As we speak loop-aes have patches for kernels up to 2.6.27, however if you are going to use the bleeding edge 2.6.28, I'm afraid that you are going to patch your kernel like I did myself. dm-crypt: This is a weak alternative to loop-aes for those who want easy setup for their encrypted partitions, I said this is weak but not insecure because of the fact that it is actually hard to mount an attack on its design flaw but still feasible. The flaw is that dm-crypt stores key information and other arguments in the first block in the encrypted disk or partition, which makes it possible to identify the cipher used in the encryption process with the possibility of extracting more information from it. Personally I took the effort of manually patching my kernel for loop-aes.
  • 13. shaXsum and md5sum Some of you might have heard about hashes before, they are implemented in many ways nowadays, but the most known ones are checking against a password by storing the computed hash for the password and compare it to the provided password's computed hash. SHA Family is a suite-b NSA cryptographic hashing algorithms, which are pretty good compared to MD5 which is made by RSA Labs. Examples: ~# echo “Cryptos are fun” | sha1sum ~# sha256sum /home/d4de/somefile -b I meant to not give an example for MD5, because as of december 2008 at CCC conference, a practical collision attack mounted successfully which caused to forge and validate intermediate SSL certificates, in result most if not all CA's changed their hash algorithms to SHA or some strong equivalent.
  • 14. Final words Please remember the following points ... (1) A hacker is not a cracker. (2) Security mindset is something you need to develop, not to “purchase”. (3) Cryptography is NOT Security. (4) A strong cryptographic cipher weakly implemented makes your “security” vulnerable, but that does NOT mean that the cipher is weak. (5) Hire a thief to teach you how to protect your car, do NOT hire a cop. This presentation will be available at my website at (http://amr-ali.co.cc).
  • 15. Security and Cryptography in Linux EGLUG session presented by – Amr Ali
  • 16. Key points What the word “hacker” means? ● Cryptography? You mean the username/password thing? ● ● Security is NOT Cryptography. ● Is there a security mindset? ● I'm not a gov agency, why should I care about security? ● Security through obscurity? Pffft .. yeah right. ● Linux way of applying security measures and practical cryptography.
  • 17. A hacker Hacker (noun): Is an intelligent, talented, and innovative person that have a combination of skills that allows him/her to bring innovation to reality. A hacker could be, an inventor, a programmer (mainly), a systems engineer, or anyone that could think outside of the box and bring ideas and solutions that are not present.
  • 18. Cryptography, what? Cryptography is not the username/password fields, this is called authentication, in the other hand, cryptography is thee art of encryption, which turns plain text to cipher text. /* Authentication */ Username: Alice Password: ****** /* Cryptography (Encryption) */ “I'm welling to pay you the agreed amount of money which is $2000.” ---> “AB76CD5E9F0F77D6A55E2A....” As we can see encryption something really we don't see on daily bases if not at all, because most of the time it is implemented to be transparent to the user.
  • 19. Security is not cryptography! Cryptography is a security field, not security it self. A cryptographer: is a person that makes (en/de)cryption algorithms to be implemented into a certain manner. A security engineer: is a person that implements cryptographic algorithms into applications. The strongest part of any security system is cryptography, however implementation might have weaknesses.
  • 20. Security Minds Being a security engineer is really not just a title and a high salary job with a pile of certifications. NO! It takes dedication and hard work to “develop” security aware mind, for example .... A security engineer would think if he could ... Shoplift at the mall while he's shopping, and how to exploit a ● certain vulnerability in the system itself. ● Steal a car from the repair shop by knowing the car's owner last name. ● Etc....
  • 21. Security for everybody Y'all might ask yourselves, why should I have security measures in my company network or home computer? The answer is very simple, it is like giving out your car's keys to a stranger, if you didn't protect the key and the car, someone else going to make use of them, and 99% of the time it is not going to be in your best interest.
  • 22. Security through obscurity This security scheme of providing security by secrecy is proven to be defunct for many reasons, despite the fact that it does not really make your system any stronger, but rather weaker. From an attacker point of view, if you are following this scheme, you are basically making it harder to probe your system for security weaknesses, however that exact measure gives a higher probability that there are weaknesses in the system, which once found, your whole product becomes vulnerable to that weakness and with time, exploitation is inevitable. The good way to go is to harden the security design itself so you don't have to worry about reverse engineering, besides, it gives more confidence to your future client, that he knows what exactly is happening.
  • 23. The Linux Way Linux gives us the freedom to apply cryptographic measures without doing any coding at all. There are hundreds of tools and resources Linux provides, we will have a look at them in the following order .... /dev/random & /dev/urandom ● aespipe, loop-aes and dm-crypt (weaker due to design) ● ● Sha1sum, sha256sum, sha512sum, md5sum (INSECURE)
  • 24. /dev/random & /dev/urandom /dev/random: is a TRNG or a True Random Number Generator, it uses different sources as entropy (e.g hardware clocks, network traffic, etc...). This character device provides very high level of entropy, however if the internal pool got exhausted, it blocks until more environmental noise is available. /dev/urandom: (“unlocked” random) is a CSPRNG or a Cryptographically Secure Pseudo Random Number Generator, the big difference here is that it reuses the pool after it gets exhausted, which in return a bit less entropy in the output than its counter part /dev/random.
  • 25. aespipe, loop-aes & dm-crypt aespipe: I guess its name explains its function pretty well, but it is basically an application that you could pipe through plain-text data and get cipher-text data as output, which in result makes it a very good handy tool in your cryptographic collection. Examples: ~# echo “Cryptos are fun” | aespipe -e aes256 -H sha512 ~# mkisofs -r /home/d4de | aespipe -e aes196 -T > image.iso As we can see in the first example, we just simply encrypted the phrase “Cryptos are fun” with AES256 cipher and hashed the key with SHA512, simple enough? Now if you are going after encrypting an ISO image file and then burn it to a blank CD, so you would be asked for a password to be able to mount the CD; this one line in the second example should do it for you.
  • 26. aespipe, loop-aes & dm-crypt loop-aes: Is just your normal loop device except it provides encryption/decryption with the use of AES ciphers. As we speak loop-aes have patches for kernels up to 2.6.27, however if you are going to use the bleeding edge 2.6.28, I'm afraid that you are going to patch your kernel like I did myself. dm-crypt: This is a weak alternative to loop-aes for those who want easy setup for their encrypted partitions, I said this is weak but not insecure because of the fact that it is actually hard to mount an attack on its design flaw but still feasible. The flaw is that dm-crypt stores key information and other arguments in the first block in the encrypted disk or partition, which makes it possible to identify the cipher used in the encryption process with the possibility of extracting more information from it. Personally I took the effort of manually patching my kernel for loop-aes.
  • 27. shaXsum and md5sum Some of you might have heard about hashes before, they are implemented in many ways nowadays, but the most known ones are checking against a password by storing the computed hash for the password and compare it to the provided password's computed hash. SHA Family is a suite-b NSA cryptographic hashing algorithms, which are pretty good compared to MD5 which is made by RSA Labs. Examples: ~# echo “Cryptos are fun” | sha1sum ~# sha256sum /home/d4de/somefile -b I meant to not give an example for MD5, because as of december 2008 at CCC conference, a practical collision attack mounted successfully which caused to forge and validate intermediate SSL certificates, in result most if not all CA's changed their hash algorithms to SHA or some strong equivalent.
  • 28. Final words Please remember the following points ... (1) A hacker is not a cracker. (2) Security mindset is something you need to develop, not to “purchase”. (3) Cryptography is NOT Security. (4) A strong cryptographic cipher weakly implemented makes your “security” vulnerable, but that does NOT mean that the cipher is weak. (5) Hire a thief to teach you how to protect your car, do NOT hire a cop. This presentation will be available at my website at (http://amr-ali.co.cc).