Alguien cambió lo que no debía. Un caso real

Vidrios de colores En strong_password v0.0.7 rubygem hijacked Tute Costa nos cuenta cómo descubrió que alguien había robado una cuenta y había cambiado una de las gemas (gems) que utiliza su aplicación.

Aparentemente, le habían robado las credenciales al autor a través de uno de esos robos habituales en diversos servicios y la mala práctica de reutilizar las contraseñas entre distintos servicios. Sin doble factor de autentificación.

Además, el mensaje podría ser que estas cosas pasan hasta en las mejores familias. O algo así.

Seguridad para gente normal

El baño Una lectura interesante en What I Learned Trying To Secure Congressional Campaigns donde Maciej Cegłowski nos cuenta su trabajo en la campaña de las elecciones en EEUU y su trabajo para tratar de llevar la seguridad informática a diferentes colectivos implicados con esta campaña. En particular, los candidatos, sus equipos y familias.

Todos tenemos más o menos clara la idea de lo que hay que aconsejar en términos de segurida informática a una persona de la calle. Sin embargo, no todo el mundo se ha puesto a trabajar de la mano con gente real para ver cómo podrían aplicar esos consejos. Y el autor tiene esa experiencia y nos la cuenta.

This article is specifically about campaign security, or how to keep candidates and their staff and families safe from people trying to break into social media, read their email, or wire their campaign war chest to Nauru. There are a lot of even more hopeless problems, like election security, but as you will see there is plenty to lose hope about just in this corner of the problem space.

Se trata de preocuparse de los aspectos técnicos, pero no sólo de ellos.

I fear that by fixating on the technical content of the briefings, we are missing an opportunity for a much richer, more satisfying nerdfight about process.

Y es difícil hasta conseguir la atención de estas personas, cuyo tiempo es escaso y tiene otras prioridades:

… is the hard part. Like Mike Tyson says, “everybody has a plan until they’re punched in the face.” Everyone has security checklist for campaigns until they try to schedule a meeting.

Por supuesto, tener en cuenta que no se tiene el mejor equipamiento, ni los mejores programas ni, por supuesto, el dinero necesario para esta parte.

You have to accept the fact that computers are broken, software is terrible, campaign finance is evil, …

Ofrecer ayuda en seguridad informática cuando no hemos tenido ningún incidente es como ofrecer una limpieza dental: todo el mundo entiende que es interesante, pero pueden dejarlo de lado con un pequeño sentimiento de culpa.

Offering security training is like being a dentist offering a teeth cleaning. Everyone understands in the abstract that this is something they need. They feel guilty about putting it off. Maybe if you are really persuasive and can talk in scary terms about gum disease, they will agree to do it. But they will not enjoy it, and however much they promise, they are never going to floss.

Yendo a los aspectos más prácticos, conviene centrarse en lo que realmente necesitan:

Collect information about what devices people are using, their email provider, whether they have two-factor authentication, how they share documents in the campaign, how they keep track of passwords, and so on. Explain that you are not a Russian spy. Make them do all their overdue software updates in front of you while you start part 2 (10 minutes).

Aconsejar sobre el uso del doble factor de autentificación.

Introduce U2F security keys and explain how they prevent the kind of attack that ensnared John Podesta. Demonstrate how to use them and what to do if you lose them. Have everyone open their laptop and walk them through the setup, then demo a trial login, with the key and with a backup method. (30 minutes)

Hablar del correo y los adjuntos y ayudar con estrategias para mejorar un poco la seguridad.

Talk about email and attachments. This part is almost like sex education: you preach abstinence, but you know the moment you leave the room, they’ll be double-clicking on whatever Excel spreadsheet the DCCC forwarded them that day. Explain high-risk behaviors, low-risk behaviors, and how to open stuff more safely in GDrive. Try to push the campaign towards shared Google Docs and Signal instead of email. (20 minutes)

Finalmente recomienda hablar de los dispositivos y buenas costumbres sobre contraseñas.

If additional time is available, talk about devices and password habits.

Mucha gente muy productiva parece tener muy malas costumbres.

Sometimes the most productive people on a campaign are volunteers with unfixable bad technology habits.

Es mejor dar consejos concretos y sencillos que muy amplios y difíciles de aplicar.

Nobody acts on the DNC/Belfer Center Cybersecurity Campaign Playboook recommendations, because they are too vague. I found it best to treat the Belfer document as a revered holy text that required exegesis to be understood by the faithful.

También puede ser una buena idea hablar de niveles de seguridad y facilitar el camino para ir mejorándola poco a poco.

Talking about degrees of safety, and giving people an incremental path to secure behavior. For example, we told campaigns it was best to have a password manager, okay to have a written list of random passwords, dangerous to have a password pattern you would modify across sites, and unacceptable to re-use a single password across sites .

También evitar avergonzar a la gente o maltratarla: su trabajo no es asegurar sus herramientas de trabajo ni solucionar los problemas que otros están creando continuamente.

Shame reduction. I tried to emphasize to people that there was an entire security community rooting for them, and that it shouldn’t be their job to have to get all these broken technologies right. I learned if you refrain from shaming people, they will eventually confess some horrific sins, and snitch on others.

Las analogías relacionadas con la salud pública pueden funcionar: porque el mensaje de la salud ya está en nuestro ideario, porque son aplicables, hacen que la gente esté más segura y no están dirigidas a público especializado.

Using public health analogies. It was tricky at first to figure out how to convince people the threat was real without scaring them into apathy. The analogy to public health did the job. I told people they were getting the ‘wash your hands, boil your water’ version of security advice, which communicated several ideas: that the guidelines were practical, that they made people safer, and that they weren’t targeted at “tech” people.

Los gestores de contraseñas son un buen consejo, pero no es sencillo empezar a utilizarlos.

Password managers. I was never able to find a way to set people up on a password manager in the time available. Let me be very clear: I would like all people to use a password manager. Every night, I dream of a world where people use password managers.

But I never found a way to get people onto 1password in a single training session.

Si no se puede usar un gestor de contraseñas, no está mal aprender a generar una contraseña larga y única y apuntarla en la aplicación de notas del teléfono.

In the end, I told candidates to generate unique passwords and save them in the notes app on their phone, or write them down on a card they kept in their wallet. And I’d do it again!

Creo que es una buena lectura.

Cabeceras más humanas para la web

La web De vez en cuando encontramos una entrada como esta y la recomendamos: HTTP headers for the responsible developer habla justamente de eso, las cabeceras que se recomienda enviar hoy en día pensando en la seguridad y en un trato adecuado a nuestros lectores. Si se puede, claro.

Como desarrolladores tenemos una responsabilidad, que es construir cosas que ayudan y dan fuerza a las personas.

Developers have the power to build the web for everyone, but that power needs to be used responsibly. What matters, in the end, is building things that help and enable people.

Luego hablan de las cabeceras relacionadas con una conexión segura, con una política adecuada de contenidos (CSP)… Pero también se preocupan del coste (que no haga falta una máquina de última generación para poder usar nuestro sitio, por ejemplo).

While I write this article, I sit in front of a relatively new MacBook using my fast Wi-Fi connection at home. Developers often forget that a setup like this is not the default for most of our users. People visiting our sites use old phones and are on crappy connections. Heavy and bloated sites with hundreds of requests give them a bad experience.

También con respeto para los usuarios, no hacerles esperar, no molestarles innecesariamente…

Finalmente, también nos recuerda que debe ser para todo el mundo.

In this article, I only covered a few headers that could help improve the user experience. If you want to see an almost complete overview of headers and their possibilities I can recommend having a look at Christian Schaefer’s slide deck “HTTP headers – the hidden champions”

Muy interesante.

Las credenciales se pueden escapar por donde menos te lo esperas

Cerrado En Git ransom campaign incident report—Atlassian Bitbucket, GitHub, GitLab una nota que emitieron Bitbucket, GitHub y GitLab sobre el secuestro de sitios gestionados dentro de sus sistemas.

Today, Atlassian Bitbucket, GitHub, and GitLab are issuing a joint blog post in a coordinated effort to help educate and inform users of the three platforms on secure best practices relating to the recent Git ransomware incident.

Algunos usuarios entraban a la plataforma y se encontraban con que alguien había entrado en sus cuentas y había ‘secuestrado’ su contenido. Aparentemente se debería al despiste de estos usuarios que habrían divulgado sus credenciales de alguna forma.

Each of the teams investigated and assessed that all account compromises were the result of unintentional user credential leakage by users or other third-parties, likely on systems external to Bitbucket, GitHub, or GitLab.

En estos sitios se observaba actividad de datos en el fichero .git/config y otros parecidos que, en algunas ocasiones contenían credenciales, tokens de acceso y otros datos sensibles.

Further investigation showed that continuous scanning for publicly exposed .git/config and other environment files has been and continues to be conducted by the same IP address that conducted the account compromises, as recently as May 10.

Los consejos para protegerse son los de siempre: utilizar doble factor, utilizar claves fuertes y únicas para cada sitio, utilizar un gestor de contraseñas…

Use strong and unique passwords for every service.

Y, con respecto a los tokens de acceso, considerarlos como credenciales y gestionarlos de manera adecuada (lo que incluye no ponerlos en el propio código).

Algunas ideas sobre código correcto

Un contrato... Otra lectura interesante, Foundations of Correct Code donde se habla de que el código no sólo ha de pasar los tests y las pruebas, sino que estas deben tener en cuenta que el código sea correcto.

En este sentido nos recuerda los conceptos de los contratos, pre y post-condiciones y nos recuerda su historia:

You may well have heard the terms before: contract, pre-condition, post-condition. But you might not be aware of their origins.

Posteriormente, entra en la discusión entre lo que llamamos programación defensiva (si no se cumple lo que esperamos lanzamos un error antes de hacer algo que, a priori, puede ser incorrecto) o bien el diseño por contrato, basado en el principio de que si el proveedor cumple su parte, nosotros devolveremos un resultado correcto.

We have two choices here: defensive programming, and Design by Contract.

Defensive programming guards the body of a function or method, checking that the pre-condition holds and throwing an error if it doesn’t.

all of the interactions between its components must be correct. A Hoare triple describes a contract between a client and a supplier of a service (e.g., a method of a class), such that the supplier ensures that the post-condition is satisfied, and the client ensures that they never a method or function unless the pre-condition is satisfied.

A la hora de elegir, puede depende de nuestra relación con el resto de proveedores: si nosotros producimos todo el código, hay cosas que podemos (o deberíamos poder) asegurar. En otros casos, tenemos que tener cuidado con lo que hayan podido hacer otras personas.

One final thought on defensive programming vs. Design by Contract, relating to the design of the system as a whole: when it’s us writing the client code, we have control over whether the inputs are correct. When someone else is providing the inputs – e.g., a web service client, or an end user – we don’t have that control. So it’s usually necessary to code defensively at system/service boundaries.

Tampoco tiene sentido conformarse con lanzar un error cuando algo no vaya bien: normalmente el usuario puede que ni siquiera tenga la culpa y nosotros tampoco queremos molestarle.

Offering users choices that aren’t actually available and then displaying an error message when they select them not only annoys the user, but also complicates the application’s internal logic as it now has to handle more edge cases.

De esta forma, es posible que tengamos que usar ambas aproximaciones:

I’ve found the best approach to delivering correct software that’s simple in its internal logic is to design the UX carefully to simplify the inputs, do some defensive programming just below the UI to validate the inputs, and then apply Design by Contract for all the internal logic, with test-time assertion checking in case we made a boo-boo in some client code.