La cadena de suministro y a qué principios debemos prestar atención

Defensa Seguimos con la cadena de suministro. Recordatorio: se trata de atacar alguno de los elementos de los que depende nuestro proyecto, pero que están gestionados por otras personas (servicios, bibliotecas, …).

En How Hackers Compromise the Software Supply Chain hablan del tema.

If you consider all the components you need for your software, you have a pretty long chain, and those components have dependencies too. Any weak link can compromise the entire software supply chain, putting your business at risk.

¿Ocupación de nombres? Ya habíamos hablado de los paquetes que se llaman parecido a otros legítimos y que la gente termina instalando sin darse cuenta. Imaginemos ahora que un atacante descubre algún nombre de un proyecto que se aloja en un repositorio privado. ¿Podría registrar ese nombre en uno público y engañarnos?

If hackers find the name of one of the private repositories, they can register public repositories with the same name and upload their version of what is supposed to be an internal library.

En cualquier caso, es muy difícil evitar cualquier problema de este tipo que pueda aparecer. Los consejos: seguir una política muy estricta de proveedores, registrar repositorios públicos con los nombres de los privados, actualizar los programas (con sus propios riesgos), asegurar todos los ficheros de configuración, tener especial cuidado con las cuentas privilegiadas (si les engañan a ellos será peor), tener niveles de defensa y monitorización (vigilancia) y compartimentalizar. Nada muy nuevo, pero a veces lo olvidamos.

Have a stricter vendor policy. Don’t source from multiple private registries when you can use only one.

When you register a private repository, register a public repository with the same name to prevent typosquatting.

Keep all software up to date, even if the update process is now a risk too.

Secure all configuration files and never deploy them on production, or, at least restrict their access.

Be extremely careful with IT management interfaces. Privileged accounts with a super high level of access should be few.

Have several layers of defense and use monitoring tools such as SIEM or SOAR to detect suspicious behaviors early.

Segment your networks. Don’t let any breach at a low level expose the whole system.

La cadena de suministro y la seguridad

Huesca.Semana Santa. Cadenas. El (pen)último fallo de moda ha sido, desde este verano, el ataque a la cadena de suministro.

De ello nos hablan en Secure software supply chain: why every link matters y nos dicen que se refiere a bibliotecas, código, hardware y otras herramientas que nos proporcionan (o directamente tomamos) otros y que nos sirven para nuestros propios proyectos.

In software, the raw materials are common libraries, code, hardware, and tools that transform code into a final deliverable. This deliverable can be deployed as either a user-facing application, a service (starting over with the same supply chain loop), or another package artifact that is included as a dependency, part of a different product.

Si alguien ataca a alguno de estos proveedors, ¿qué sucederá con nuestro proyecto?

Software supply chain attack happens when some malicious element is introduced in this chain.

A successful attack in any link of the supply can propagate the compromised code or component downstream, completely unnoticed, and cause mayhem across different stages.

Álvaro Iradier cuenta varios ejemplos, y algunas recomendaciones. La principal: establecer conexiones fuertes con proveedores confiables y verificados.

So the approach for securing every single piece and link is very different and cannot be covered as a whole. But, whether you are a supplier or a consumer (or both), you need to put the focus on securing your processes and establishing strong connections with trusted and verified providers.

JavaScript y las prestaciones

Motores del puente giratorio JavaScript no es mi lenguaje favorito y estoy por decir que sus efectos en la web de hoy en día están siendo poco útiles. Sin embargo, simpatizo con cualquier cosa que nos pueda hacer mejorar en algo y en How JavaScript engines achieve great performance porque, seguramente, se pueda aplicar a más dominios.

Me quedo con dos pinceladas, la detección de funciones ‘calientes’ (hot), esto es, funciones que se llaman con frecuencia y su traducción a instrucciones de máquina (otpimización cuando se necesita y no todo el rato: lo que haríamos con un perfilador). Con la ventaja de que al haberla ejecutado ya algunas veces se pueden hacer todavía más optimizaciones, estas especulativas, que todavía podrían hacer el código más rápido.

Whenever the JavaScript engine detects that a function is hot (that is, executed many times) it hands that function over to an optimizing compiler. This compiler translates the virtual machine instructions into actual machine instructions. What’s more, since the function has already been run several times, the optimizing compiler can make several assumptions based on previous runs. In other words, it can perform speculative optimizations to make even faster code.

Si se descubre que las suposiciones son falsas, se puede ‘desoptimizar’ y volver a comenzar el proceso.

What happens if, later on, these speculations turn out to be wrong? The JavaScript engine can simply delete the optimized, but wrong, function, and revert to using the unoptimized version. Once the function has been run several more times, it can attempt to pass it to the optimizing compiler again, this time with even more information that it can use for speculative optimizations.

Hay más, pero lo que procede es recomendar la lectura para sacarle todo el partido. Sobre todo si están interesados en el tema.

La protección de secretos en sistemas

Caja registradora En How we protect our most sensitive secrets from the most determined attackers un buen repaso de medidas y estrategias destinadas a proteger los secretos de un banco.

As a bank, we have a lot of secrets we need to protect to keep our customers and ourselves safe. These include private keys that only we know, which we use to digitally sign requests as coming from us (sort of like a private password).

Las amenazas, nos dicen, pueden venir de la cadena de suministro (la gran tendencia desde este verano), un atacante externo o uno interno (¿nos acordamos de estos últimos?)

Valdrá la pena leer tambień How our security team handle secrets y Securely delegating trust with digital signatures and secret storage systems.

HTTP, fuzzing e inseguridad con componentes seguras

Banderas y frontera Ya hemos hablado a veces de las herramientas de fuzzing y cómo podían permitir encontrar fallos de seguridad. También hemos hablado de los parámetros del protocolo HTTP y algunas manipulaciones. En esta ocassión podemos hablar de la reunión de ambos mundos. En New differential fuzzing tool reveals novel HTTP request smuggling techniques nos contaban cómo unos investigadores habían descubierto nuevos fallos utilizando herramientas de fuzzing.

In a white paper the researchers discuss how they discovered a wealth of new vulnerabilities using the fuzzing tool, which they said can be used by bug bounty hunters and researchers alike.

Nos recuerda el fallo de manipulación de peticiones HTTP del que se empezó a hablar en 2005.

HTTP request smuggling, which first emerged in 2005, interferes with how websites process sequences of HTTP requests received from users.

Los fallos a los que se refieren aparecen cuando hay balanceadores de carga y reenvíos de cabeceras, que pueden ser utilizados para hacer pasar algunas peticiones a través de esa infraestructura.

If there is a discrepancy between the front- and back-end servers, it can allow attackers to smuggle hidden requests through the proxy.

Es un ejemplo de lo que se llama interacción insegura entre componentes seguras: cada una de ellas puede ser perfectamente válida, pero las diferencias entre ellas pueden provocar problemas.

The paper reads: “These processors may not necessarily be individually buggy; but when used together, they disagree on the parsing or semantics of a given HTTP request, which leads to a vulnerability.

Las técnicas se basan en enviar ligeras variaciones entre peticiones HTTP para detectar inconsistencias y posibles problemas.

It exercises two target servers with the same mutated request, and compares the responses to identify discrepancies that lead to smuggling attacks.

En definitiva, tener componentes seguras no garantiza la seguridad de un sistema, porque la seguridad tiene que ser una propiedad del sistema completo.

“Secure components do not necessarily make a secure system; security is an emergent property of the system as a whole.

Muy interesante.