<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hellen on Medium]]></title>
        <description><![CDATA[Stories by Hellen on Medium]]></description>
        <link>https://medium.com/@_charcoal_roses_?source=rss-7b8649944120------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*D8KwZoyQgVish7f93L6cCA.png</url>
            <title>Stories by Hellen on Medium</title>
            <link>https://medium.com/@_charcoal_roses_?source=rss-7b8649944120------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 12:24:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@_charcoal_roses_/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[requestAnimationFrame and Canvas in chrome.offscreen: What Really Happens]]></title>
            <link>https://medium.com/@_charcoal_roses_/requestanimationframe-and-canvas-in-chrome-offscreen-what-really-happens-510a16553400?source=rss-7b8649944120------2</link>
            <guid isPermaLink="false">https://medium.com/p/510a16553400</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <dc:creator><![CDATA[Hellen]]></dc:creator>
            <pubDate>Wed, 24 Dec 2025 20:20:30 GMT</pubDate>
            <atom:updated>2025-12-24T21:33:53.261Z</atom:updated>
            <content:encoded><![CDATA[<h3>requestAnimationFrame and canvas in chrome.offscreen: What Really Happens</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AC5WQYZkFVAAVJxu_g21AQ.png" /></figure><h3>Abstract</h3><p>In this article, we will talk about an interesting scenario of working with canvas rendering in a chrome.offscreen document and a subtle edge case related to using requestAnimationFrame.</p><h3>Opening third‑party pages inside chrome.offscreen</h3><p>In Chrome extensions, there is such functionality as chrome.offscreen. It is a special type of hidden document that allows web extensions (Manifest V3+) to run DOM‑dependent APIs that are not available inside service workers. Typical use cases include:</p><ul><li><strong>Audio Playback:</strong> Managing HTMLAudioElement in the background for music or notifications without a visible player.</li><li><strong>Complex Media:</strong> Performing heavy canvas operations or media processing in an isolated environment.</li><li><strong>Clipboard Operations:</strong> Securely handling copy/paste actions that require DOM access (like selecting text).</li><li><strong>Web Scraping/DOM Manipulation:</strong> Accessing and manipulating web page content (even cross-origin) for data extraction, a task difficult for service workers.</li><li><strong>Persistent Connections:</strong> Maintaining WebSocket connections that might otherwise be interrupted in a service worker.</li><li><strong>Authentication Flows:</strong> Handling complex authentication processes, like Firebase Auth, by leveraging iframes and web APIs.</li><li><strong>Lazy Loading Scripts:</strong> Dynamically loading JavaScript only when needed in the background.</li></ul><p>Unlike a regular tab, chrome.offscreen document has <strong>no visible UI</strong> and <strong>cannot be focused</strong> (📖 <a href="https://developer.chrome.com/docs/extensions/reference/api/offscreen"><em>Documentation: chrome.offscreen</em></a>).</p><p>In rare but valid scenarios, an extension may open a third‑party website inside an offscreen document, for example, using an &lt;iframe&gt;. This can be useful for:</p><ul><li>Web scraping</li><li>Creating page snapshots</li><li>Extracting computed layout or rendered content</li><li>Any task that requires opening pages seamlessly without user interaction</li></ul><p>In such a setup, the loaded page may contain a &lt;canvas&gt; element with images or animations rendered on it.</p><h3>Using requestAnimationFrame with canvas</h3><p>Engineers often rely on requestAnimationFrame (rAF) when rendering graphics on canvas. This technique is commonly used for performance reasons and is recommended in many canvas optimization guides ( 📖<em> </em><a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Optimizing_canvas#more_tips"><em>MDN reference: Optimizing canvas</em></a><em> ).</em></p><h4>How requestAnimationFrame works</h4><p>requestAnimationFrame schedules a callback that runs <strong>right before the browser performs a repaint</strong>. Its main benefits are:</p><ul><li>Synchronization with the display refresh rate</li><li>Reduced unnecessary renders</li><li>Better battery and CPU efficiency</li></ul><p>A typical rendering loop looks like this:</p><pre>function draw() {<br>ctx.clearRect(0, 0, canvas.width, canvas.height);<br>// draw something<br>requestAnimationFrame(draw);<br>}<br><br>requestAnimationFrame(draw);</pre><p>Because the browser controls when frames are rendered, this approach avoids wasted work when frames are not visible.</p><h3>Minimal canvas example</h3><p>A very basic example of rendering an image on &lt;canvas&gt; with the <em>fade‑in </em>animation effect using requestAnimationFrame can be found here (branch cat-viewer):</p><p><a href="https://github.com/AlyonaPianykh/demo-chrome-extension-rAF-canvas-offscreen/blob/17c88afc99fa9d22f04a7ff0dfb483d4579f4be0/index.html#L76">demo-chrome-extension-rAF-canvas-offscreen/index.html at 17c88afc99fa9d22f04a7ff0dfb483d4579f4be0 · AlyonaPianykh/demo-chrome-extension-rAF-canvas-offscreen</a></p><p>And the deployed demo version is available at <a href="https://alyonapianykh.github.io/demo-chrome-extension-rAF-canvas-offscreen/"><em>this link</em></a>. This preview site displays a <strong>random cat picture</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UlC7eTGR1mZ7D4k460mWUg.png" /></figure><blockquote>P.S. the cat on this example image looks very like <a href="https://www.instagram.com/loveyoustepan/#">loveyoustepan</a>.</blockquote><p>In a normal visible tab, this approach works as expected: the image is rendered, and reading canvas data (for example, via toDataURL() or getImageData()) returns valid content.</p><h3>The problem: blank canvas in chrome.offscreen</h3><p>When the same logic is executed inside a chrome.offscreen document, developers may observe an unexpected result: <strong>the canvas remains blank</strong> when attempting to read its contents.</p><p>This happens even though:</p><ul><li>The page loads successfully</li><li>The canvas element exists in the DOM</li><li>The rendering code is executed</li></ul><h3>Why this happens</h3><p>According to MDN, requestAnimationFrame is explicitly designed to pause when a page is not visible: 📖 <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame"><em>Documentation: requestAnimationFrame</em></a><em>:</em></p><blockquote>requestAnimationFrame() calls are paused in most browsers when running in background tabs or hidden <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe">&lt;iframe&gt;</a>s, in order to improve performance and battery life.</blockquote><p>The background tab is a non-active, unfocused tab. <br>Chrome documentation states that chrome.offscreen creates a <strong>hidden document</strong> that cannot be focused: 📖 <a href="https://developer.chrome.com/docs/extensions/reference/api/offscreen#concepts_and_usage"><em>Documentation: offscreen api</em></a><em>.</em></p><p>This has an important implication:</p><ul><li>The offscreen document itself is hidden</li><li>Any iframes inside it are hidden as well</li><li>No actual repaint cycle is guaranteed</li></ul><p>Since requestAnimationFrame depends on the rendering pipeline, the browser simply never schedules animation frames.</p><h3>Result</h3><p>Because the requestAnimationFrame callback does not run:</p><ul><li>Canvas draw calls never reach a rendered frame</li><li>Reading canvas content using toDataURL() or getImageData() returns empty or transparent data</li></ul><p>This behavior is <strong>by design</strong>, not a bug.</p><h3>A practical solution: forcing a requestAnimationFrame polyfill</h3><p>The solution to this unfortunate behavior is to <strong>force a polyfill for </strong>requestAnimationFrame.</p><p>Instead of relying on the browser’s rendering loop, we explicitly override requestAnimationFrame with a timer‑based implementation (for example, backed by setTimeout). This gives us deterministic execution even in a hidden environment such as chrome.offscreen.</p><p>The polyfill can be injected into the iframe using <strong>web</strong> <strong>extension content scripts</strong>, but there is one very important requirement:</p><blockquote><em>⚠️ The polyfill </em><strong><em>must be injected at the very beginning of page loading</em></strong><em>.</em></blockquote><p>This ensures that:</p><ul><li>The page’s own scripts see the requestAnimationFrame overwrite</li><li>Canvas rendering logic is initialized with the polyfill from the start</li><li>No rendering code binds to the native (paused) rAF implementation</li></ul><p>If the polyfill is applied too late, the page may already have scheduled rendering logic that will never run.</p><h3>Demo project</h3><p>To demonstrate the problem and the solution, I prepared a working example:</p><p><a href="https://github.com/AlyonaPianykh/demo-chrome-extension-rAF-canvas-offscreen/tree/main">GitHub - AlyonaPianykh/demo-chrome-extension-rAF-canvas-offscreen</a></p><p>The project contains a standalone demo site, <a href="https://alyonapianykh.github.io/demo-chrome-extension-rAF-canvas-offscreen/"><em>available here</em></a><em> </em>(already mentioned above), and web extension code.</p><h3>How the extension demo works</h3><p>In the main branch of the repository, you will find a Chrome extension that:</p><ul><li>Uses chrome.offscreen</li><li>Loads the same demo site inside an &lt;iframe&gt;</li><li>Attempts to read canvas data from the iframe</li><li>Displays the extracted image on the extension page</li></ul><p>This setup makes the rendering issue and its resolution easy to observe.</p><p>ReadMe.md file explains how to install it locally for testing.</p><h3>Step‑by‑step walkthrough</h3><p>Here is a walkthrough of how to reproduce the issue and see the fix in action:</p><blockquote><em>▶️ </em><a href="https://github.com/AlyonaPianykh/demo-chrome-extension-rAF-canvas-offscreen?tab=readme-ov-file#demo-video">Demo video</a> is available.</blockquote><ol><li><strong>Open the extension page</strong><br>When the extension is opened, an offscreen document is created automatically. Inside this offscreen page, an iframe with the demo site is loaded. The ofscreen.html document is available in the “Details” section of the added Chrome extension under <em>chrome://extensions/.</em></li><li><strong>Attempt to read canvas data</strong><br>Click the <strong>“</strong>Get Iframe Canvas Content<strong>”</strong> button. At this point: <br>- The extracted canvas image is blank<br>- A base64 string is printed on the right side. You can verify that this image is empty with this base64 string using any Base64 decoder, for example: <a href="https://base64.guru/converter/decode/image">https://base64.guru/converter/decode/image</a></li><li><strong>Change the image inside the iframe</strong><br>Click “New cat” inside the iframe. The visible canvas inside the iframe updates, but calling <strong>“</strong>Get Iframe Canvas Content<strong>”</strong> again still produces a blank image.</li><li><strong>Apply the polyfill</strong><br>Click the “Override requestAnimationFrame” toggle.<br>This injects and activates the requestAnimationFrame polyfill inside the iframe.</li><li><strong>Read the canvas data again</strong><br>Click <strong>“</strong>Get Iframe Canvas Content<strong>”</strong> once more.<br>This time, the canvas data is successfully captured and is no longer blank.</li><li><strong>Verify dynamic updates</strong><br>Click “New cat” inside the iframe again.<br>The newly rendered image is correctly reflected in the extracted canvas data.</li><li><strong>Disable the polyfill</strong><br>Toggle the switch to remove the polyfill.<br>After doing so, clicking “Get Iframe Canvas Content” will once again return a blank image.</li></ol><h3>Final thoughts</h3><p>Thank you for your attention!</p><p>I hope this material proves useful and helps save debugging and investigation time for others working with chrome.offscreen, canvas, and rendering‑dependent APIs.</p><p>If you have comments, suggestions, or corrections, please feel free to leave a comment — I’ll be more than happy to discuss and iterate on these ideas.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=510a16553400" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Проходження U.A. High School TryHackMe]]></title>
            <link>https://medium.com/@_charcoal_roses_/%D0%BF%D1%80%D0%BE%D1%85%D0%BE%D0%B4%D0%B6%D0%B5%D0%BD%D0%BD%D1%8F-u-a-high-school-tryhackme-788e9a1d3d6d?source=rss-7b8649944120------2</link>
            <guid isPermaLink="false">https://medium.com/p/788e9a1d3d6d</guid>
            <dc:creator><![CDATA[Hellen]]></dc:creator>
            <pubDate>Fri, 21 Mar 2025 19:54:08 GMT</pubDate>
            <atom:updated>2025-03-21T19:54:08.892Z</atom:updated>
            <content:encoded><![CDATA[<h3>Проходження U.A. High School від TryHackMe</h3><p>Хочу поділитися проходженням кімнати U.A. High School на платформі TryHackMe.</p><p>Завдання полягало у наступному: дістати 2 флага в файлах user.txt та root.txt, які треба було знайти у веб додатку:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X59QilR7BJMsw0iwLG7--Q.png" /></figure><p>Що ж, приступимо.</p><h4>Аналіз веб сайту</h4><p>Перш за все дослідимо, що собою являє той сайт.<br>Це вебсайт на декілька сторінок, переважно інформаційного характеру. В розмітці сторінок, а також в .css файлі я нічого особливого не помітила, ніякої sensitive інформації.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0sVv5q0iLeckPT43cCzp2A.png" /></figure><p>Проте я знайшла, що картинка, яка використана як фон для сторінок, знаходиться у папці <strong>/assets/images</strong>. Якщо попробувати доступитись до неї з адресної строки браузера — отримаємо помилку, яка вкаже нам який сервер використовується для цього сайту, що в принципі може бути розцінено як data exposure, який ми шукаємо:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iF03k1gIUNf_Qo3oTk547A.png" /></figure><p>Ще один цікавий момент — це сторінка Contact, яка містить в собі форму. Це може наштовхнути нас на ідею про XSS інїєкції. Я спробувала передати деякі команди Linux, але це не дало результату.</p><h4>Enumeration (Енумерація)</h4><p>Наступним пробуємо знайти відкриті порти в нашому сервері. Для цього я використала команду:</p><pre>nmap -T4 -p- -A -v ip_address</pre><ul><li>-T4 : Прискорює скануванняза рахунок зменшення проміжків часу між спробами зондування, що може бути більше помітно для систем моніторингу мережі;</li><li>-p- : інструктує nmap сканувати всі 65,535 портів. За замовчуванням, nmap сканує найбільш поширені 1,000 портів, ця опція розширює список портів для сканування до всіх можливих;</li><li>-A : для визначення операційної системи та версії, Script scanning базовим набором скриптів, а також Traceroute, який забезпечує комплексний огляд цілі. Це агресивний режим;</li><li>-v : Активує verbose (детальний) режим, надаючи більш детальні дані під час процесу сканування.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*beK7J4V9GBT5FkZiSQICLw.png" /></figure><p>Ми знайшли вже відому нам інформацію про http порт 80, а також новий ssh порт 22, який дає розуміння, що ми можемо встановити ssh з’єднання до нього.</p><p>Потім, йшла черга енумерації директорій.<br>Я спробувала застосувати спершу dirsearch, але для вкладених директорій треба декілька разів запускати вручну його ще і ще:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*H4Udxge0Zw_xNshZXyAI4g.png" /></figure><blockquote>команда: <strong>dirsearch -u ip_address</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*eWtQsNH6f7nJOn_W7D8mbA.png" /></figure><p>Але цю інформацію ми і так виявили при досліджені сайту.<br>Тож далі я використала dirb, який знайшов новий файл index.php — дуже цікаво!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*zK3r2z7IITbHp7tut-qDnA.png" /></figure><blockquote>команда: <strong>dirb ip_address</strong></blockquote><p>Виглядає так, що далі в справу підуть PHP XSS ін’єкції. Cross-Site Scripting (XSS) — це форма ін’єкційної атаки, коли шкідливі сценарії впроваджуються в довірені веб-програми. XSS зазвичай вставляється через веб-сайт за допомогою hyperlink або веб-форми. Вставлений код можна використовувати будь-якою клієнтською мовою, наприклад JavaScript, PHP, і т.д. Проста XSS-атака відбудеться на вразливий веб-сайт, який приймає дані користувача через параметри запиту GET і відображає дані на веб-сайті.</p><p>Перше, що вартує спробувати, це додати до шляху /assets/index.php квері параметри ?cmd=whoami і вуаля!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4kQ9JknJBmsWDITKYkBVOw.png" /></figure><p>Ми отримали якусь успішну відповідь. Давайте подивимось, ця стрічка виглядає як base64 формат. Спробуємо задекодити:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7hfrHbDeULOE16QZr1dOQg.png" /></figure><p>Ми розуміємо, що це системний користувач www-data , стандартний для веб серверів, які базуються на Ubuntu (Apache, nginx, і т.д).</p><p>Далі можемо пробувати атаку Reverse Shell.</p><h4>Reverse Shell Attack</h4><p>Reverse Shell — це метод віддаленого мережевого доступу до комп’ютера, коли атакуючий отримує <strong>зворотне підключення</strong> від цільової машини. Тобто, комп’ютер жертви стає сервером, а комп’ютер зловмисника — клієнтом. Це дозволяє атакуючому отримати доступ до оболонки (shell) командного рядка цільової машини та виконувати команди від її імені.</p><p>Я відкрила сервер для прослуховування за допомогою команди</p><blockquote>nc -lvp 4444</blockquote><p>І далі скористалась сайтом, який закріплений в Firefox нашої atackbox <a href="https://www.revshells.com/">revshell</a> і скопіювала цей код payload, який нам знадобаться для атаки:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tKSwts5L6naJK1U2Glyeow.png" /></figure><p>Вставила цей код в браузерну строку після <strong>cmd= </strong>і ми отримали з’єднання:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MPt-1QH-bpCjg20YjDKZog.png" /></figure><p>Якщо походити подивитись файли в папці <strong>/images</strong> окрім нашого файла фону сайта є ще файл <strong>oneforall.jpg</strong>.<strong> </strong>Можно відкрити інший термінал і скачати цей файл за допомогою команди:</p><blockquote>wget <a href="http://ip_address/assets/images/oneforall.jpg">http://ip_address/assets/images/oneforall.jpg</a></blockquote><p>При спробі його відкрити видає помилку:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xrq2GJhZ9GK9TFGifTkw_g.png" /></figure><p>Я погуглила цю помилку, і перше же посилання на <a href="https://stackoverflow.com/questions/11310220/why-am-i-getting-the-error-not-a-jpeg-file-starts-with-0x89-0x50">stackoverflow</a>. Виглядає так, що хтось підмінив заголовки у картинки.</p><h4>Підміна заголовку картинки</h4><p>Мушу визнати, ця частина далась мені не легко, тому що я обрала не саму зручну программу для цього, саме Hex Editor, який встановлений на цій attackbox. Можливо простіше, ефективніше і швидше буде застосувати якусь інакшу утіліту.</p><p>Помилка каже нам, що заговолок картинки відповідає формату .png, але файлик має розширення .jpg. Спробуємо замінити заголовок на заголовок для .jpg формату.</p><p>Я знайшла який має бути заголовок у картинок формату .jpg тут: <a href="https://en.wikipedia.org/wiki/List_of_file_signatures">https://en.wikipedia.org/wiki/List_of_file_signatures</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N5Fe8uU_yTDElTUIGWimxw.png" /></figure><p>Заміна виглядала так:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wczucKb4GdMBZHjMmmwQGw.png" /></figure><p>І після збереження з коректним заголовком картинка стає доступна:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvbyiPlzaxICF2Zx4j8ZHw.png" /></figure><p>Я звісно пошукала в гуглі по картинці, знайшла персонажа Izuku Midoriya.</p><p>Що робити далі? Можливо в картинці щось заховано?</p><h4>Стеганографія (Steganography)</h4><p>Стеганографія — це метод приховування інформації всередині іншого об’єкта (зображення, аудіо, відео, тексту) так, щоб її неможливо було помітити без спеціального аналізу. На відміну від криптографії, яка приховує зміст інформації (шифрування), стеганографія приховує сам факт існування повідомлення.</p><p>Зазвичай, для доступу до прихованої інформації потрібен пароль.</p><p>Давайте пошукаємо ще на атакованій машині.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*IkQSyJsL150tjg8Jzk9yQA.png" /></figure><p>Походивши по системі і папках я знайшла <strong>Hidde_Content</strong>, в середині якого був файл <strong>passphrase.txt</strong>. Зчитавши цей файл, отримуємо знову якийсь base64 текст. Якщо задекодити його наприклад використовуючт якийсь онлайн декодер серівіс, отримаємо пароль.</p><p>Давайте спробуємо подивитись, чи цей пароль підійде для того, щоб дістати скритий контент з картинки.</p><p>Взагалі, є купа хороших термінальних утиліт, зокрема steghide для цих цілей, але я використала онлайе сервіс <a href="https://futureboy.us/stegano/">futureboy.us/stegano</a>, який під капотом використовує ці сервіси. І сервіс показав скритий контент нашої картинки, де був логін — пароль для користувача Deku.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dNmrWenyo-qHgH_GgarmJw.png" /></figure><p>Давайте подивимось, чи є на атакованій машині, такий користувач. Для цього можно виконати команду</p><blockquote>cat /etc/passwd</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*6AZNsXXdnPgJ7f2F3_O13g.png" /></figure><p>І дійсно, такий користувач є. Пам’ятаємо, що при Енумерації ми знайшли порт 22, спробуймо встановити ssh з’єднання, використовуючи знайдену інформацію.</p><h4>SSH з’єднання</h4><p>Для встановлення з’єднання з портом використаємо команду:</p><blockquote>ssh ip_address -l deku</blockquote><p>де параметр <strong>-l</strong> дозволяє нам прокинути ім’я користувача. Вводимо знайдений пароль. З’єднання встановлено.</p><p>Дивимось, що тут є на машині.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*XkmP-pWS79AynjAB4u2ZCg.png" /></figure><p>Зразу знаходимо файл user.txt, і прочитавши його отримуємо наш перший флаг.</p><p>Далі, оскільки ми на машині під користувачем Deku, спробуймо команда <strong>sudo -l</strong> використовується для <strong>перегляду прав sudo</strong> для поточного користувача:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*_pfqAdnDsKRAef3sxInrzA.png" /></figure><p>Виглядає, що Deku може виконувати файл з розширенням .sh, дуже цікаво! Подивимось, що в тому файлі:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KnNfPQLqy1osxIwBbqqkDA.png" /></figure><p>Тут можна побачити цікавий блок <strong>eval “echo $feedback”</strong>. В теорії, ми могли б передати туди якусь команду на виконання, наприклад для запису у такі файли, як /etc/passwd або кореневу папку ssh.</p><h4>Privilege Escalation (Підвищення привілеїв)</h4><p>Це процес отримання <strong>більш високих прав доступу</strong> у системі, ніж було надано спочатку.</p><p>Спробуймо надати нашому юзеру більше доступу. Для цього я я спробувала записати наступну комунду:</p><blockquote>deku ALL=NOPASSWD: ALL &gt;&gt; /etc/sudoers</blockquote><p>як фідбек, виконавши файл <strong>./feedback.sh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*Iuz6Y1MX67MoMn9twNko2g.png" /></figure><p>Перевірка, яка є в <strong>./feedback.sh </strong>має пропустити такий синтаксис. Ця команда має дати доступ користувачу deku виконувати sudo без введення паролю.</p><p>Далі пробуємо подивитись права знову <strong>sudo -l. </strong>Виконуємо команду<strong> sudo su — </strong>(switch user) з правами суперкористувача<strong> (root)</strong> через <strong>sudo</strong>. І тепер ми root користувач. Знайдемо і прочитаємо наш другий файл з флагом root.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OI-Y-B4zdO9wbJKseQTcyA.png" /></figure><p>Це все!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=788e9a1d3d6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>