Algunos consejos prácticos sobre criptografía para programadores

cueva Ya hemos hablado otras veces de criptografía: que no hay que inventarla, que hay que usar métodos conocidos y reconocidos… Sin embargo, no es tan fácil ponerse a utilizar criptografía, sobre todo cuando lo que alguien quiere es tan sencillo como cifrar sus datos de manera razonable, sin tener que convertirse en un critptógrafo o un criptoanalista. Por eso me gustó leer Cryptography for programmers 2: Blocks and Randomness donde explican justamnente esa parte, los bloques y cómo se emplean en el cifrado y el tema de la aleatoriedad (otro ‘favorito’ de este sitio).

Si alguien está interesado la entrada forma parte de una serie de cuatro, dedicadas a los principios básicos, y otros temas interesantes, además de este.

Se habla de cifrado simétrico y asimétrico para luego hablar de la criptografía de bloques, que es la que suele utilizarse cuando se habla de cifrado simétrico.

Block cryptography is the default symmetric cryptography used nowadays, and so it will be the only symmetric cryptography that will be covered in the series.

La idea es cifrar una cantidad fija de bits mediante un algoritmo simétrico y los bloques nos permiten manejar estas cuestiones. Luego pasa a explicarnos qué tipo de bloques serían recomendables.

For the purpose of this post I would say as a programmer there is no reason you should be using anything other than AES. AES is the current standard, it is secure enough and will very likely continue to be for a long time, specially if you are using the variant with a 256 bit key, which I would recommend.

Luego habla de los generadores de números seudoaleatorios, que es un tema que hemos tocado más veces aquí.

Interesante.

Ataques laterales para obtener información: la memoria como WiFi

Memorias. Hay toda una familia de ataques que se basan en tratar de obtener información sobre un sistema a partir de lo que llaman canales laterales: variaciones de diferentes parámetros que pueden medirse y que pueden ayudar a un atacante a obtener información.

Hoy traemos Exfiltrating Data from Air-Gapped Computers via Wi-Fi Signals (Without Wi-Fi Hardware) que habla de cómo se puede comprometer un sistema para que los chips de memoria de nuestro ordenador pudieran llegar a generar emisiones electromagnéticas en la banda de 2.4GHz como si fuera una WiFi. Estas señales podrían ser recibidas por múltiples dispositivos que estuvieran en las proximidades y se podrían utilizar para robar información.

Dubbed “AIR-FI,” the attack hinges on deploying a specially designed malware in a compromised system that exploits “DDR SDRAM buses to generate electromagnetic emissions in the 2.4 GHz Wi-Fi bands” and transmitting information atop these frequencies that can then be intercepted and decoded by nearby Wi-Fi capable devices such as smartphones, laptops, and IoT devices before sending the data to remote servers controlled by an attacker.

Al ser generado por los chips de memoria, no es necesario que el sistema tenga antenas WiFi ni nada parecido; el atacante simplemente puede generar esas emisiones electromagnéticas y enviar datos a través de ellas.

“Instead, an attacker can exploit the DDR SDRAM buses to generate electromagnetic emissions in the 2.4 GHz Wi-Fi bands and encode binary data on top of it.”

Esta sería una posible vía de ataque para robar información de sistemas desconectados de la red, claro.

Para poder realizar el ataque es necesario infectar el equipo, y disponer de otro que haga de receptor y que esté suficientemente cerca.

Curioso.

IoT, nuestra casa y la seguridad

Puerta. Troy Hunt ha estado domotizando su casa y ha escrito una serie de entradas sobre las decisiones que iba tomando. Me pareció particulamente interesante el aspecto de la seguridad, siendo un experto como es él. Lo contaba en IoT Unravelled Part 3: Security.

En el internet de las cosas IoT, siempre se nombra la seguridad como una preocupación (dispositivos pequeños, poco potentes… Pero también falta de madurez, fabricantes muy diversos y algunos oportunistas…). Lo resumía así:

In part 1 of this series, I posited that the IoT landscape is an absolute mess but Home Assistant (HA) does an admirable job of tying it all together.

Algunos fabricantes ya dan cuenta de la seguridad con dispositivos que se actualizan automáticamente. Si nos salimos del camino, es posible que nos metamos en líos.

For your average consumer (and remember, that’s probably 99%+ of people buying TP-Link smart plugs), automatically updating firmware is key. For the rest of us, we need to recognise that we take on risks when using IoT devices in ways they weren’t designed for.

Otro debate interesante es analizar si nuestros dispositivos deben ‘vivir’ dentro de nuestra red local, o tener interacciones con la nube.

This whole discussion about devices updating their firmware raised another philosophical debate which I want to delve into now, and that’s the one about how self-contained the IoT ecosystem should be within the LAN versus having cloud dependencies.

La nube, y los fabricantes emergentes nos pueden colocar en situaciones comprometidas: ¿qué sucedería si el fabricante de nuestros dispositivos deja de proporcionar sus servicios?

That resiliency extends beyond just a cloud outage too; what if Tuya shuts down the service? Still want to be able to turn your lights on?

Desde un punto de vista, entonces, de seguridad y privacidad, parece natural apostar por aparatos que dependan exclusivamente de nuestra propia red.

That said, from a simple security and privacy perspective (and often a performance perspective too), I always prioritise local communication.

También hay que considerar la compartimentalización: una solución es aislar estos dispositivos en su propia red, para que si hay problemas de seguridad no afecten al resto de nuestra vida.

One popular approach is to isolate the network the IoT things are on from the network the non-IoT things are on. This mindset is akin to putting all the potentially bad eggs in the one basket and the good eggs (such as your PC) in another basket.

Pero queremos poder controlar nuestros dispositivos desde nuestro ‘dispositvo seguro’ y empieza el lío de interactuar entre esas redes diferentes.

The main problem is that you end up with all sorts of scenarios where a particular IoT device needs to see the app that controls it but because the very purpose of the VLAN is to lock the IoT things away, things would fail.

Entonces, hay que asegurar la cosa, y … usar sólo lo que realmente queramos/necesitemos, porque no podemos perder lo que no tenemos (por ejemplo, a la hora de apuntar una cámara):

  1. You cannot lose what you do not have … As it relates to my own approach to IoT, all cameras I have point at places that are publicly observable.

Y, por lo tanto, más vale ser selectivos en lo que conectamos. Hace nuestro análisis de riesgos, decidiendo qué cosas buenas tendremos y qué cosas malas pueden pasar.

  1. Be selective with what you connect: … The point here is that I’m effectively doing my own little risk assessment on each IoT device, and you can too. What upside does it bring you? What downside does it present?

Finalmente, estar seguros de en quién confiamos. Fabricantes, instaladores, apartos… Lo barato puede salirnos muy caro. Y, ojo, una marca conocida no siempre será una garantía de buena calidad.

  1. Choose who to trust: … These companies invest serious dollars in their security things in just the same way Amazon does with their Echo devices.

También hay que vencer la inercia: si no tenemos nada conectado, ¿por qué asumir ese riesgo? Hunt dice que su vida es mejor y más cómoda y, en ese sentido, puede valer la pena.

There will be those who respond to this blog post with responses along the lines of “well, you really don’t need any of these things connected anyway, why take the risk?” There’s an easy answer: because it improves my life.

Tampoco hay que olvidar que un experto puede hacer muchas cosas que alguien menos interesado no hará. Y allí puede estar el peligro para esta persona.

Coming back to a recurring theme from this series, the security situation as it relates to normal everyday people using IoT devices isn’t great and I’ve given plenty of examples of why that’s the case. I also don’t believe the approaches taken by enthusiasts solves the problem in any meaningful way …

Espiar lo que tecleamos en una videoconferencia

Teclado flexibilizado En This horrifying Zoom hack will deter you from ever side-chatting again nos contaban cómo un grupo de investigadores de la Universidad de Texas en San Antonio pueden adivinar lo que estamos tecleando en nuestra sesión de videoconferencia con una precisión del 93%.

Researchers from the University of Texas at San Antonio and the University of Oklahoma have demonstrated something terrifying: They can read what people are typing during video calls on Zoom, Skype, and Google Hangouts with up to 93% accuracy.

Y no se refieren a la típica metedura de pata de tener otra cámara, o que la que tenemos apunte a donde no debe o, que escribamos la contraseña por error en el chat.

We’ve all side-chatted, saying one thing to the camera, and another on the side. Maybe it was a joke over Gchat at a coworker’s expense. Maybe it was just multitasking some emails. Maybe it was entering a password into another site.

¿Cómo lo hacen? Observando e interpretando los movimientos de nuestra espalda.

Without using any special machine learning or artificial intelligence techniques, Jadliwala’s team figured out how to read the subtle pixel shifts around someone’s shoulders to make out their basic cardinal movements: north, south, east, and west.

Por ejemplo, para escribir CAT (gato) parece que primero escribirmos la ‘C’, nos movemos a la izquierda, hacia la ‘A’ y, finalmente, hacia la derecha para teclear la ‘T’.

Applied to a keyboard, these four directions actually mean a lot. If you are typing “cat,” you start with the C, move west to the A, then back east to the T.

Es suficiente con registrar los movimientos de la espalda y relacionarlos con un diccionario de palabras habituales.

Once researchers figured out how to read these directions through shoulder movements, they were able to create software that could cross-reference them with what they call “word profiles” built with an English dictionary, which turned the maze of directions into meaningful words.

El problema es que los proveedores no pueden hacer mucho para defendernos, tal vez emborronar nuestro contorno un poco.

But our research is not Zoom or Google specific. They cannot do anything about it at the software level in some sense.”

Las formas en que nos pueden atacar son múltiples, y cada vez hay personas más igeniosas.