From 7a0e1efa7e88d68e1f3e81d27fae44d8d0eb0e44 Mon Sep 17 00:00:00 2001 From: Homero304 Date: Mon, 7 Sep 2020 10:03:04 -0500 Subject: [PATCH 1/3] The clickjacking attack --- .../06-clickjacking/article.md | 152 +++++++++--------- .../clickjacking-visible.view/facebook.html | 2 +- .../clickjacking-visible.view/index.html | 6 +- .../clickjacking.view/facebook.html | 2 +- .../clickjacking.view/index.html | 6 +- .../protector.view/iframe.html | 8 +- .../top-location.view/iframe.html | 2 +- .../top-location.view/index.html | 8 +- 8 files changed, 93 insertions(+), 93 deletions(-) diff --git a/3-frames-and-windows/06-clickjacking/article.md b/3-frames-and-windows/06-clickjacking/article.md index 1daa87dd0..09dc34d44 100644 --- a/3-frames-and-windows/06-clickjacking/article.md +++ b/3-frames-and-windows/06-clickjacking/article.md @@ -1,79 +1,79 @@ -# The clickjacking attack +# El ataque de secuestro de clics -The "clickjacking" attack allows an evil page to click on a "victim site" *on behalf of the visitor*. +El ataque "secuestro de clics" permite que una página maligna haga clic en un "sitio víctima" * en nombre del visitante *. -Many sites were hacked this way, including Twitter, Facebook, Paypal and other sites. They have all been fixed, of course. +Muchos sitios fueron pirateados de esta manera, incluidos Twitter, Facebook, Paypal y otros sitios. Todos han sido arreglados, por supuesto. -## The idea +## La idea -The idea is very simple. +La idea es muy simple. -Here's how clickjacking was done with Facebook: +Así es como se hizo el secuestro de clics con Facebook: -1. A visitor is lured to the evil page. It doesn't matter how. -2. The page has a harmless-looking link on it (like "get rich now" or "click here, very funny"). -3. Over that link the evil page positions a transparent ` - + */!* -
...And you're cool (I'm a cool hacker actually)!
+
...Y eres genial (en realidad soy un pirata informático genial)!
``` -The full demo of the attack: +La demostración completa del ataque: [codetabs src="clickjacking-visible" height=160] -Here we have a half-transparent ` ``` -There are other ways to work around that simple protection too. +También hay otras formas de evitar esa simple protección. ## X-Frame-Options -The server-side header `X-Frame-Options` can permit or forbid displaying the page inside a frame. +El encabezado del lado del servidor `X-Frame-Options` puede permitir o prohibir mostrar la página dentro de un marco. -It must be sent exactly as HTTP-header: the browser will ignore it if found in HTML `` tag. So, `` won't do anything. +Debe enviarse exactamente como encabezado HTTP: el navegador lo ignorará si se encuentra en la etiqueta HTML ``. Entonces, `` no hará nada. -The header may have 3 values: +El encabezado puede tener 3 valores: `DENY` -: Never ever show the page inside a frame. +: Nunca muestra la página dentro de un marco. `SAMEORIGIN` -: Allow inside a frame if the parent document comes from the same origin. +: Permitir dentro de un marco si el documento principal proviene del mismo origen. `ALLOW-FROM domain` -: Allow inside a frame if the parent document is from the given domain. +: Permitir dentro de un marco si el documento principal es del dominio dado. -For instance, Twitter uses `X-Frame-Options: SAMEORIGIN`. +Por ejemplo, Twitter usa `X-Frame-Options: SAMEORIGIN`. ````online -Here's the result: +Aquí está el resultado: ```html ``` - + -Depending on your browser, the `iframe` above is either empty or alerting you that the browser won't permit that page to be navigating in this way. +Dependiendo de su navegador, el `iframe` anterior está vacío o le advierte que el navegador no permitirá que esa página navegue de esta manera. ```` -## Showing with disabled functionality +## Mostrando con funcionalidad deshabilitada -The `X-Frame-Options` header has a side-effect. Other sites won't be able to show our page in a frame, even if they have good reasons to do so. +El encabezado `X-Frame-Options` tiene un efecto secundario. Otros sitios no podrán mostrar nuestra página en un marco, incluso si tienen buenas razones para hacerlo. -So there are other solutions... For instance, we can "cover" the page with a `
` with styles `height: 100%; width: 100%;`, so that it will intercept all clicks. That `
` is to be removed if `window == top` or if we figure out that we don't need the protection. +Así que hay otras soluciones... Por ejemplo, podemos "cubrir" la página con un `
` con estilos `height: 100%; width: 100%;`, de modo que interceptará todos los clics. Ese `
` debe eliminarse si `window == top` o si descubrimos que no necesitamos la protección. -Something like this: +Algo como esto: ```html ``` -The demo: +La demostración: [codetabs src="protector"] -## Samesite cookie attribute +## Atributo Samesite cookie -The `samesite` cookie attribute can also prevent clickjacking attacks. +El atributo `samesite` cookie también puede prevenir ataques de secuestro de clics. -A cookie with such attribute is only sent to a website if it's opened directly, not via a frame, or otherwise. More information in the chapter . +Una cookie con dicho atributo solo se envía a un sitio web si se abre directamente, no a través de un marco o de otra manera. Más información en el capítulo . -If the site, such as Facebook, had `samesite` attribute on its authentication cookie, like this: +Si el sitio, como Facebook, tenía el atributo `samesite` en su cookie de autenticación, así: ``` Set-Cookie: authorization=secret; samesite ``` -...Then such cookie wouldn't be sent when Facebook is open in iframe from another site. So the attack would fail. +...Entonces dicha cookie no se enviaría cuando Facebook esté abierto en iframe desde otro sitio. Entonces el ataque fracasaría. -The `samesite` cookie attribute will not have an effect when cookies are not used. This may allow other websites to easily show our public, unauthenticated pages in iframes. +El atributo `samesite` cookie no tendrá efecto cuando no se utilicen cookies. Esto puede permitir que otros sitios web muestren fácilmente nuestras páginas públicas no autenticadas en iframes. -However, this may also allow clickjacking attacks to work in a few limited cases. An anonymous polling website that prevents duplicate voting by checking IP addresses, for example, would still be vulnerable to clickjacking because it does not authenticate users using cookies. +Sin embargo, esto también puede permitir que los ataques de secuestro de clics funcionen en algunos casos limitados. Un sitio web de sondeo anónimo que evita la duplicación de votaciones al verificar las direcciones IP, por ejemplo, aún sería vulnerable al secuestro de clics porque no autentica a los usuarios que usan cookies. -## Summary +## Resumen -Clickjacking is a way to "trick" users into clicking on a victim site without even knowing what's happening. That's dangerous if there are important click-activated actions. +El secuestro de clics es una forma de "engañar" a los usuarios para que hagan clic en el sitio de una víctima sin siquiera saber qué está sucediendo. Eso es peligroso si hay acciones importantes activadas por clic. -A hacker can post a link to their evil page in a message, or lure visitors to their page by some other means. There are many variations. +Un pirata informático puede publicar un enlace a su página maligna en un mensaje o atraer visitantes a su página por otros medios. Hay muchas variaciones. -From one perspective -- the attack is "not deep": all a hacker is doing is intercepting a single click. But from another perspective, if the hacker knows that after the click another control will appear, then they may use cunning messages to coerce the user into clicking on them as well. +Desde una perspectiva, el ataque "no es profundo": todo lo que hace un pirata informático es interceptar un solo clic. Pero desde otra perspectiva, si el pirata informático sabe que después del clic aparecerá otro control, entonces pueden usar mensajes astutos para obligar al usuario a hacer clic en ellos también. -The attack is quite dangerous, because when we engineer the UI we usually don't anticipate that a hacker may click on behalf of the visitor. So vulnerabilities can be found in totally unexpected places. +El ataque es bastante peligroso, porque cuando diseñamos la interfaz de usuario generalmente no anticipamos que un pirata informático pueda hacer clic en nombre del visitante. Entonces, las vulnerabilidades se pueden encontrar en lugares totalmente inesperados. -- It is recommended to use `X-Frame-Options: SAMEORIGIN` on pages (or whole websites) which are not intended to be viewed inside frames. -- Use a covering `
` if we want to allow our pages to be shown in iframes, but still stay safe. +- Se recomienda utilizar `X-Frame-Options: SAMEORIGIN` en páginas (o sitios web completos) que no están destinados a verse dentro de marcos. +- Usa una cubierta `
` si queremos permitir que nuestras páginas se muestren en iframes, pero aún así permanecer seguras. diff --git a/3-frames-and-windows/06-clickjacking/clickjacking-visible.view/facebook.html b/3-frames-and-windows/06-clickjacking/clickjacking-visible.view/facebook.html index 6b8231c71..884c08033 100644 --- a/3-frames-and-windows/06-clickjacking/clickjacking-visible.view/facebook.html +++ b/3-frames-and-windows/06-clickjacking/clickjacking-visible.view/facebook.html @@ -3,7 +3,7 @@ - + diff --git a/3-frames-and-windows/06-clickjacking/clickjacking-visible.view/index.html b/3-frames-and-windows/06-clickjacking/clickjacking-visible.view/index.html index 9f8d82197..98008ea45 100644 --- a/3-frames-and-windows/06-clickjacking/clickjacking-visible.view/index.html +++ b/3-frames-and-windows/06-clickjacking/clickjacking-visible.view/index.html @@ -19,14 +19,14 @@ } -
Click to get rich now:
+
Haga clic para hacerse rico ahora:
- + -
...And you're cool (I'm a cool hacker actually)!
+
...Y eres genial (en realidad soy un pirata informático genial)!
diff --git a/3-frames-and-windows/06-clickjacking/clickjacking.view/facebook.html b/3-frames-and-windows/06-clickjacking/clickjacking.view/facebook.html index 6b8231c71..884c08033 100644 --- a/3-frames-and-windows/06-clickjacking/clickjacking.view/facebook.html +++ b/3-frames-and-windows/06-clickjacking/clickjacking.view/facebook.html @@ -3,7 +3,7 @@ - + diff --git a/3-frames-and-windows/06-clickjacking/clickjacking.view/index.html b/3-frames-and-windows/06-clickjacking/clickjacking.view/index.html index 05ec48cb8..cd4d4e087 100644 --- a/3-frames-and-windows/06-clickjacking/clickjacking.view/index.html +++ b/3-frames-and-windows/06-clickjacking/clickjacking.view/index.html @@ -19,14 +19,14 @@ } -
Click to get rich now:
+
Haga clic para hacerse rico ahora:
- + -
...And you're cool (I'm a cool hacker actually)!
+
...Y eres genial (en realidad soy un pirata informático genial)!
diff --git a/3-frames-and-windows/06-clickjacking/protector.view/iframe.html b/3-frames-and-windows/06-clickjacking/protector.view/iframe.html index a1ca6fcc9..3895aec2b 100644 --- a/3-frames-and-windows/06-clickjacking/protector.view/iframe.html +++ b/3-frames-and-windows/06-clickjacking/protector.view/iframe.html @@ -20,7 +20,7 @@ - This text is always visible. + Este texto siempre está visible. - But if the page was open inside a document from another domain, the div over it would prevent any actions. + Pero si la página estuviera abierta dentro de un documento de otro dominio, el div sobre ella evitaría cualquier acción. - + diff --git a/3-frames-and-windows/06-clickjacking/top-location.view/iframe.html b/3-frames-and-windows/06-clickjacking/top-location.view/iframe.html index da477f400..a617dce91 100644 --- a/3-frames-and-windows/06-clickjacking/top-location.view/iframe.html +++ b/3-frames-and-windows/06-clickjacking/top-location.view/iframe.html @@ -7,7 +7,7 @@ -
Changes top.location to javascript.info
+
Cambia top.location a javascript.info