OpenSSL Cheat Sheet v1.1

I have released a new OpenSSL Cheat Sheet version. The version 1.1.

You can download the PDF here: https://albertx.mx/wp-content/uploads/2020/07/The-OpenSSL-Cheat-Sheet-v1.1.pdf

or access the online version, here: https://cheatography.com/albertx/cheat-sheets/openssl/

Release notes for version 1.1:

  • Inclusion of openssl command for generating random bytes specifying bytes of length for random data, in “Basics” section.
  • Added the command for displaying digital certificates information in Abstract Sintax Notation One, in “Digital Certificates” section.
  • Inclusion of command for generating a hash with its output in bytes, instead of hex encoding. This command is under “working with hashes” section.

Encrypt cardholder data in transit. PCI-DSS Requirement 4 recommendations.

credit cards

On Internet, when protecting sensitive data, in transit you must use the security protocols you’ve heard of, like HTTPS, SSH, SFTP, FTP/S, TLS, VPN, IPSec and more, however, using only these protocols is not enough when following methodologies like “defense at depth”, where you need more security layers to tackle most of the threats and risks regarding data exposure when sending or receiving data.

In this post I will talk about recommendations you can follow to increase the level of security of critical and sensitive data while transmiting data anywhere, from internal networks to public or insecure networks.

Continue reading Encrypt cardholder data in transit. PCI-DSS Requirement 4 recommendations.

Conocimientos básicos para esquemas de cifrado

Últimamente se ha incrementado la demanda de servicios y soluciones de seguridad informática de una forma “esperada” debido no precísamente al incremento de los ataques ocurridos en los últimos años sino a la difusión y comunicación que ha habido de dichos ataques, derivando esto en una preocupación creciente por protegerse de ellos y no convertirse en víctima.

Una de los métodos de protección que se han visto en incremento es el uso de criptografía para proteger los datos al transmitirlos o en descanso. Comenzando por el incremento del uso del protocolo HTTPS, buzones ligeramente más seguros por SFTP, generación de <<túneles>> TLS, VPN, IPSec para transmisión de datos, entre otros. Sin embargo también el desarrollo de esquemas de seguridad (criptográficos) “propios” se ha visto en aumento. Estos esquemas pueden ser desde una simple implementación de un cifrado de un dato con AES hasta esquemas complejos para protección de datos en flujos de trabajo complejos entre diferentes ambientes, infraestructura, compañías.

Una de las vulnerabilidades más explotadas en criptografía es el mal diseño de estos esquemas de seguridad criptográfica que en ocasiones terminan siendo fatales para la tecnología. Tal es el caso del casi obsoleto WEP en tecnologías inalámbricas hoy en día.

El problema que existe con la generación de estos esquemas es la carencia de información, capacitación, conocimientos o experiencia en las partes involucradas en esta creación. No hay que olvidar que uno de los temas más complejos en seguridad informática es la criptografía pues involucra una formación un tanto distinta o mejor dicho más especializada en ciertas áreas para poder entenderla.

Haciendo un listado de los puntos que se deberían dominar para garantizar un esquema con cierto nivel aceptable de seguridad son:

  • Rendimiento de los algoritmos de cifrado según el tipo de dato a cifrar/descifrar
  • Dominio total de los modos de operación para algoritmos de cifrado por bloques
  • Completo entendimiento y manejo de la información a nivel de bytes
  • Generación de entropía e información pseudo-aleatoria criptográficamente segura
  • Administración, generación y protección de llaves de cifrado
  • Dominio del poder computacional existente y en incremento
  • Conocimiento y entendimiento de vulnerabilidades en los algoritmos de cifrado
  • Entendimiento total de los protocolos actuales que utilizan esquemas de encripción: IPSec, SSH, TLS, Kerberos, WPA, etc.
  • Conocimiento e implementación de tipos de encripción: privada, pública, hashes, híbridos, etc.
  • Limitaciones y rendimiento computacional en los diferentes estados de la información: en descanso, en transmisión, en procesamiento.
  • Manejo de bibliotecas PKI y todo lo que conlleva como son:
    – Certificados Digitales
    – Listas de revocación
    – Cadenas de confianza
    – X.509
    – …
  • Manejo e implementación de codificaciones: Base64, Hex, Unicode, UTF-8, etc.

En un siguiente post mencionaré referencias para “atacar” estos temas de forma adecuada.

Entrenamiento en criptografía

Crypto
Como algunos de ustedes saben uno de mis temas favoritos (quizá el mayor) dentro del área de seguridad informática es la criptografía. Todo lo relacionado a algoritmos criptográficos, la matemática dentro de ellos, permutaciones, sustituciones, matrices y sus alrededores. Es realmente impresionante la manera en la que uno puede llegar a utilizar operaciones relativamente sencillas para generar un muro casi impenetrable que proteja, de manera digital, prácticamente cualquier cosa.
Continue reading Entrenamiento en criptografía

Microsoft Office documents encryption

Encrypt with password

This is a short post just for showing how you can protect your documents created with Microsoft Word, Excel and PowerPoint.

People love working with Microsoft Office documents. I think it’s a matter of simplicity and habit. So, one of my tasks is to give the user a safe way to protect their documents. We can use special tools for encrypting documents at byte level or hardware encryption or any other kind of tools but all of them will fail if they are not easy enough to implement.

Some Microsoft office programs have a feature called “Encrypt with password”. This isn’t neater the typical protect document functionality that just prompts you for a password if you want to open a document (although it requires a password) nor the previous protect with password that used RC4 40-bit encryption. This is a complete encryption functionality that encrypts the whole document using the password as the key. This feature is available since Microsoft Office 2007 using AES for the encryption algorithm and by default 128 bits.

If you want to encrypt a document just go to the File menu, click on Info, then Document protect and finally Encrypt with password. A box will be shown and you just have to type and confirm a strong password. Be careful because as this is an encryption mechanism that will encrypt at byte level your file if you lost the password it can take years to decrypt your file in case it was feasible.

By default office programs don’t force a strong password to be typed but if you want users to always type a strong password you have to write some keys into the windows registry. You can read the details of these keys in this article but here is a extract.

HKEY_CURRENT_USERSoftwareMicrosoftOffice14.0CommonSecurityPasswordComplexity 
HKEY_CURRENT_USERSoftwarePoliciesMicrosoftOffice14.0CommonSecurityPasswordComplexity

	* Value name: PolicyLevel
	* Value type: DWORD
	* Value data: [ 0 | 1 | 2 | 3 ]
	* Use 0 to for no complexity (default), 1 for minimum length, 2 for minimum length plus requiring 3 of 4 character groups, and 3 for all these checks plus enforcing Windows domain password rules.


	* Value name: MinLength
	* Value type: DWORD
	* Specifies the minimum length of password required.

Well, this is all for now.

HTTPS and the TLS handshake protocol.


In the previous post I talked about how web browsers connect to the server and how a negotiation is initialized between server and client to establish a secure connection when the HTTPS protocol is used.

In this post I wil explain the SSL/TLS protocol and how a client (computer, smartphone, tablet, terminal, etc) and server can encrypt the data sent and received by an HTTPS connection.
Continue reading HTTPS and the TLS handshake protocol.