You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "clickjacking" attack allows an evil page to click on a "victim site" *on behalf of the visitor*.
3
+
L'attaque par "clickjacking" permet à une page malveillante de cliquer sur un "site victime" *au nom du visiteur*.
4
4
5
-
Many sites were hacked this way, including Twitter, Facebook, Paypal and other sites. They have all been fixed, of course.
5
+
De nombreux sites ont été piratés de cette manière, notamment Twitter, Facebook, Paypal et d'autres sites. Ils ont tous été réparés, bien sûr.
6
6
7
-
## The idea
7
+
## L'idée
8
8
9
-
The idea is very simple.
9
+
L'idée est très simple.
10
10
11
-
Here's how clickjacking was done with Facebook:
11
+
Voici comment le clickjacking a été fait avec Facebook:
12
12
13
-
1.A visitor is lured to the evil page. It doesn't matter how.
14
-
2.The page has a harmless-looking link on it (like "get rich now" or "click here, very funny").
15
-
3.Over that link the evil page positions a transparent`<iframe>`with `src`from facebook.com, in such a way that the "Like" button is right above that link. Usually that's done with`z-index`.
16
-
4.In attempting to click the link, the visitor in fact clicks the button.
13
+
1.Un visiteur est attiré vers la page malveillante. Peu importe comment.
14
+
2.La page contient un lien inoffensif (du type "enrichissez-vous maintenant" ou "cliquez ici, très drôle").
15
+
3.Au-dessus de ce lien, la page maléfique place un`<iframe>`transparent avec `src`de facebook.com, de telle sorte que le bouton "J'aime" se trouve juste au-dessus de ce lien. Habituellement, cela se fait avec`z-index`.
16
+
4.En essayant de cliquer sur le lien, le visiteur clique en fait sur le bouton.
17
17
18
-
## The demo
18
+
## La démo
19
19
20
-
Here's how the evil page looks. To make things clear, the`<iframe>`is half-transparent (in real evil pages it's fully transparent):
20
+
Voici à quoi ressemble la page malveillante. Pour que les choses soient claires, le`<iframe>`est semi-transparent (dans les vraies pages maléfiques, il est totalement transparent):
@@ -45,102 +45,102 @@ iframe { /* iframe from the victim site */
45
45
<div>...And you're cool (I'm a cool hacker actually)!</div>
46
46
```
47
47
48
-
The full demo of the attack:
48
+
La démo complète de l'attaque:
49
49
50
50
[codetabs src="clickjacking-visible" height=160]
51
51
52
-
Here we have a half-transparent `<iframe src="facebook.html">`, and in the example we can see it hovering over the button. A click on the button actually clicks on the iframe, but that's not visible to the user, because the iframe is transparent.
52
+
Ici, nous avons un `<iframe src="facebook.html">` semi-transparent, et dans l'exemple, nous pouvons le voir planer au-dessus du bouton. En cliquant sur le bouton, on clique en fait sur l'iframe, mais l'utilisateur ne le voit pas, car l'iframe est transparent.
53
53
54
-
As a result, if the visitor is authorized on Facebook ("remember me" is usually turned on), then it adds a "Like". On Twitter that would be a "Follow" button.
54
+
Par conséquent, si le visiteur est connecté sur Facebook (l'option "Se souvenir de moi" est généralement activée), un bouton "J'aime" est ajouté. Sur Twitter, ce serait un bouton "Suivre".
55
55
56
-
Here's the same example, but closer to reality, with`opacity:0`for`<iframe>`:
56
+
Voici le même exemple, mais plus proche de la réalité, avec`opacity:0`pour`<iframe>`:
57
57
58
58
[codetabs src="clickjacking" height=160]
59
59
60
-
All we need to attack -- is to position the`<iframe>`on the evil page in such a way that the button is right over the link. So that when a user clicks the link, they actually click the button. That's usually doable with CSS.
60
+
Tout ce dont nous avons besoin pour attaquer -- c'est de positionner le`<iframe>`sur la page malveillante de manière à ce que le bouton soit juste au-dessus du lien. Ainsi, lorsqu'un utilisateur clique sur le lien, il clique en fait sur le bouton. C'est généralement faisable avec CSS.
61
61
62
-
```smart header="Clickjacking is for clicks, not for keyboard"
63
-
The attack only affects mouse actions (or similar, like taps on mobile).
62
+
```smart header="Le clickjacking est pour les clics, pas pour le clavier"
63
+
L'attaque n'affecte que les actions de la souris (ou des actions similaires, comme les tapotements sur les mobiles).
64
64
65
-
Keyboard input is much difficult to redirect. Technically, if we have a text field to hack, then we can position an iframe in such a way that text fields overlap each other. So when a visitor tries to focus on the input they see on the page, they actually focus on the input inside the iframe.
65
+
La saisie au clavier est très difficile à rediriger. Techniquement, si nous avons un champ de texte à pirater, nous pouvons alors positionner un iframe de telle sorte que les champs de texte se chevauchent. Ainsi, lorsqu'un visiteur essaie de se concentrer sur la saisie qu'il voit sur la page, il se concentre en fait sur la saisie à l'intérieur de l'iframe.
66
66
67
-
But then there's a problem. Everything that the visitor types will be hidden, because the iframe is not visible.
67
+
Mais il y a un problème. Tout ce que le visiteur tape sera caché, car l'iframe n'est pas visible.
68
68
69
-
People will usually stop typing when they can't see their new characters printing on the screen.
69
+
Les gens s'arrêtent généralement de taper lorsqu'ils ne voient pas leurs nouveaux caractères s'imprimer à l'écran.
70
70
```
71
71
72
-
## Old-school defences (weak)
72
+
## Défenses de la vieille école (faibles)
73
73
74
-
The oldest defence is a bit of JavaScript which forbids opening the page in a frame (so-called "framebusting").
74
+
La défense la plus ancienne est un bout de JavaScript qui interdit l'ouverture de la page dans un iframe (ce qu'on appelle le "framebusting").
75
75
76
-
That looks like this:
76
+
Cela ressemble à ceci:
77
77
78
78
```js
79
79
if (top !=window) {
80
80
top.location=window.location;
81
81
}
82
82
```
83
83
84
-
That is: if the window finds out that it's not on top, then it automatically makes itself the top.
84
+
C'est-à-dire que si la fenêtre découvre qu'elle n'est pas en haut, elle se met automatiquement en haut.
85
85
86
-
This not a reliable defence, because there are many ways to hack around it. Let's cover a few.
86
+
Ce n'est pas une défense fiable, car il existe de nombreuses façons de la contourner. En voici quelques-unes.
87
87
88
-
### Blocking top-navigation
88
+
### Blocage de la navigation supérieure
89
89
90
-
We can block the transition caused by changing `top.location`in [beforeunload](info:onload-ondomcontentloaded#window.onbeforeunload) event handler.
90
+
Nous pouvons bloquer la transition provoquée par le changement de `top.location`dans l'événement[beforeunload](info:onload-ondomcontentloaded#window.onbeforeunload).
91
91
92
-
The top page (enclosing one, belonging to the hacker) sets a preventing handler to it, like this:
92
+
La page du haut (appartenant au pirate) lui attribue un événement de prévention, comme ceci:
93
93
94
94
```js
95
95
window.onbeforeunload=function() {
96
96
returnfalse;
97
97
};
98
98
```
99
99
100
-
When the`iframe`tries to change`top.location`, the visitor gets a message asking them whether they want to leave.
100
+
Lorsque le`iframe`essaie de changer`top.location`, le visiteur reçoit un message lui demandant s'il veut quitter le site.
101
101
102
-
In most cases the visitor would answer negatively because they don't know about the iframe - all they can see is the top page, there's no reason to leave. So`top.location`won't change!
102
+
Dans la plupart des cas, le visiteur répondra négativement parce qu'il ne connaît pas l'iframe - tout ce qu'il peut voir est la page d'accueil, il n'a aucune raison de la quitter. Donc`top.location`ne changera pas!
103
103
104
-
In action:
104
+
En action:
105
105
106
106
[codetabs src="top-location"]
107
107
108
-
### Sandbox attribute
108
+
### L'attribut Sandbox
109
109
110
-
One of the things restricted by the `sandbox`attribute is navigation. A sandboxed iframe may not change`top.location`.
110
+
L'une des choses limitées par l'attribut `sandbox`est la navigation. Une iframe protégée par un sandbox ne peut pas modifier l'attribut`top.location`.
111
111
112
-
So we can add the iframe with`sandbox="allow-scripts allow-forms"`. That would relax the restrictions, permitting scripts and forms. But we omit`allow-top-navigation`so that changing `top.location`is forbidden.
112
+
Nous pouvons donc ajouter l'iframe avec`sandbox="allow-scripts allow-forms"`. Cela assouplirait les restrictions, autorisant les scripts et les formulaires. Mais nous omettons`allow-top-navigation`pour que la modification de `top.location`soit interdite.
There are other ways to work around that simple protection too.
120
+
Il existe également d'autres moyens de contourner cette simple protection.
121
121
122
122
## X-Frame-Options
123
123
124
-
The server-side header `X-Frame-Options`can permit or forbid displaying the page inside a frame.
124
+
L'en-tête `X-Frame-Options`côté serveur peut autoriser ou interdire l'affichage de la page dans un iframe.
125
125
126
-
It must be sent exactly as HTTP-header: the browser will ignore it if found in HTML `<meta>` tag. So, `<meta http-equiv="X-Frame-Options"...>`won't do anything.
126
+
Il doit être envoyé exactement comme un en-tête HTTP : le navigateur l'ignorera s'il se trouve dans la balise HTML `<meta>`. Ainsi, `<meta http-equiv="X-Frame-Options"...>`ne fera rien.
127
127
128
-
The header may have 3 values:
128
+
L'en-tête peut avoir 3 valeurs:
129
129
130
130
131
131
`DENY`
132
-
: Never ever show the page inside a frame.
132
+
: Ne jamais afficher la page à l'intérieur d'un iframe.
133
133
134
134
`SAMEORIGIN`
135
-
: Allow inside a frame if the parent document comes from the same origin.
135
+
: Autoriser à l'intérieur d'un iframe si le document parent a la même origine..
136
136
137
137
`ALLOW-FROM domain`
138
-
: Allow inside a frame if the parent document is from the given domain.
138
+
: Autoriser à l'intérieur d'un iframe si le document parent appartient au domaine donné..
139
139
140
-
For instance, Twitter uses`X-Frame-Options: SAMEORIGIN`.
140
+
Par exemple, Twitter utilise`X-Frame-Options: SAMEORIGIN`.
141
141
142
142
````online
143
-
Here's the result:
143
+
Voici le résultat:
144
144
145
145
```html
146
146
<iframe src="https://twitter.com"></iframe>
@@ -149,16 +149,16 @@ Here's the result:
149
149
<!-- ebook: prerender/ chrome headless dies and timeouts on this iframe -->
150
150
<iframe src="https://twitter.com"></iframe>
151
151
152
-
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.
152
+
Selon votre navigateur, le `iframe` ci-dessus est soit vide, soit vous avertit que le navigateur ne permet pas de naviguer sur cette page de cette manière.
153
153
````
154
154
155
-
## Showing with disabled functionality
155
+
## Affichage de la fonctionnalité désactivée
156
156
157
-
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.
157
+
L'en-tête`X-Frame-Options`a un effet secondaire. Les autres sites ne pourront pas afficher notre page dans un iframe, même s'ils ont de bonnes raisons de le faire.
158
158
159
-
So there are other solutions... For instance, we can "cover" the page with a`<div>`with styles `height: 100%; width: 100%;`, so that it will intercept all clicks. That`<div>`is to be removed if `window == top`or if we figure out that we don't need the protection.
159
+
Il existe donc d'autres solutions... Par exemple, on peut "couvrir" la page avec une`<div>`avec les styles `height: 100%; width: 100%;`, pour qu'elle intercepte tous les clics. Cette`<div>`doit être retirée si `window == top`ou si l'on s'aperçoit que l'on n'a pas besoin de cette protection.
160
160
161
-
Something like this:
161
+
Quelque chose comme ça:
162
162
163
163
```html
164
164
<style>
@@ -177,45 +177,45 @@ Something like this:
177
177
</div>
178
178
179
179
<script>
180
-
//there will be an error if top window is from the different origin
181
-
//but that's ok here
180
+
//il y aura une erreur si la fenêtre supérieure est d'une origine différente
181
+
//mais c'est bon ici
182
182
if (top.document.domain==document.domain) {
183
183
protector.remove();
184
184
}
185
185
</script>
186
186
```
187
187
188
-
The demo:
188
+
La démo:
189
189
190
190
[codetabs src="protector"]
191
191
192
-
## Samesite cookie attribute
192
+
## Attribut de cookie "samesite"
193
193
194
-
The `samesite`cookie attribute can also prevent clickjacking attacks.
194
+
L'attribut de cookie `samesite`peut également prévenir les attaques de clickjacking.
195
195
196
-
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<info:cookie#samesite>.
196
+
Un cookie avec un tel attribut n'est envoyé à un site web que s'il est ouvert directement, et non par l'intermédiaire d'un iframe ou autre. Plus d'informations dans le chapitre<info:cookie#samesite>.
197
197
198
-
If the site, such as Facebook, had `samesite`attribute on its authentication cookie, like this:
198
+
Si le site, tel que Facebook, avait l'attribut `samesite`dans son cookie d'authentification, comme ceci:
199
199
200
200
```
201
201
Set-Cookie: authorization=secret; samesite
202
202
```
203
203
204
-
...Then such cookie wouldn't be sent when Facebook is open in iframe from another site. So the attack would fail.
204
+
...Ce cookie ne serait donc pas envoyé lorsque Facebook est ouvert dans une iframe depuis un autre site. Donc l'attaque échoue.
205
205
206
-
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.
206
+
L'attribut de cookie `samesite`n'aura pas d'effet lorsque les cookies ne sont pas utilisés. Cela peut permettre à d'autres sites Web d'afficher facilement nos pages publiques, non authentifiées, dans des iframes.
207
207
208
-
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.
208
+
Toutefois, cela peut également permettre aux attaques par détournement de clics de fonctionner dans quelques cas limités. Un site Web de vote anonyme qui empêche les doubles votes en vérifiant les adresses IP, par exemple, serait toujours vulnérable au détournement de clics parce qu'il n'authentifie pas les utilisateurs à l'aide de cookies.
209
209
210
-
## Summary
210
+
## Résumé
211
211
212
-
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.
212
+
Le détournement de clics est un moyen de "tromper" les utilisateurs en les incitant à cliquer sur un site victime sans même savoir ce qui se passe. C'est dangereux s'il y a des actions importantes activées par le clic.
213
213
214
-
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.
214
+
Un hacker peut poster un lien vers sa page malveillante dans un message, ou attirer les visiteurs sur sa page par d'autres moyens. Il existe de nombreuses variantes.
215
215
216
-
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.
216
+
D'un certain point de vue, l'attaque n'est "pas profonde" : le pirate ne fait qu'intercepter un seul clic. Mais d'un autre point de vue, si le pirate sait qu'après le clic, un autre contrôle apparaîtra, il peut utiliser des messages astucieux pour contraindre l'utilisateur à cliquer également sur ces contrôles.
217
217
218
-
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.
218
+
Cette attaque est assez dangereuse, car lorsque nous concevons l'interface utilisateur, nous ne prévoyons généralement pas qu'un pirate puisse cliquer au nom du visiteur. Les vulnérabilités peuvent donc se trouver dans des endroits totalement inattendus.
219
219
220
-
-It is recommended to use `X-Frame-Options: SAMEORIGIN`on pages (or whole websites) which are not intended to be viewed inside frames.
221
-
-Use a covering`<div>`if we want to allow our pages to be shown in iframes, but still stay safe.
220
+
-Il est recommandé d'utiliser `X-Frame-Options: SAMEORIGIN`sur les pages (ou les sites entiers) qui ne sont pas destinées à être affichées dans des iframes.
221
+
-Utilisez une couverture`<div>`si nous voulons permettre à nos pages d'être affichées dans des iframes, tout en restant sécurisées.
0 commit comments