Google Chrome extension to detect and prevent Reflected XSS via special crafted URLs
The main idea of the extension is that attackers often use links that contain code in some way to carry out XSS attacks, and this code can be encoded to avoid detection by the user. To counteract such attacks, I have put together a full-fledged browser extension, which, although based on signature analysis, takes into account many coding techniques.
A script is also attached to this code for informational purposes, which can be used to receive a user Cookie to the attacker's server, it should be used to debug this program.
- Script, frame, meta tags;
- The presence of events in any tags (events are taken from the documentation);
- The presence of attributes that accept addresses, specific sources;
- Using the javascript schema:;
- Calling unsafe browser storage functions (session, local storage), Cookies;
- Eval functions;
- Calling the Image, Audio, and Option constructors.
- URL encoding, including multiple;
- Base64URL encoding;
- Base64, including substring analysis of the corresponding syntax;
- Escape sequences of Unicode, CSS, JavaScript;
- String from charCode, CodePoint functions;
- HTML coding.
- Download the file from the Release section;
- Unzip the archive;
- In Google Chrome, enable Developer mode in the extensions menu;
- After switching to the selection menu, specify the directory;
- If you need to debug on any payloads, use the test(filename) function.
Основная идея расширения в том, что злоумышленники часто для проведения XSS-атак используют ссылки, в которых каким-либо образом содержится код, причем данный код может быть закодирован, чтобы избежать обнаружения его пользователем. Чтобы противодействовать таким атакам я собрал полноценное браузерное расширение, которое хоть и базируется на сигнатурном анализе, но при этом учитывает множество техник кодирования.
К данному коду также в ознакомительных целях прикладывается скрипт, который может использоваться для получения Cookie пользователя на сервер злоумышленника, он должен использоваться для отладки данной программы.
- Теги script, frame, meta;
- Наличие событий в любых тегах (события взяты из документации);
- Наличие атрибутов, принимающих адреса, специфические источники;
- Использование схемы javascript:;
- Вызов небезопасных функций работы с хранилищем браузера (сессия, локальное хранилище), Cookie;
- Eval-функции;
- Вызов конструкторов Image, Audio, Option.
- URL-кодирование, в том числе многократное;
- Base64URL-кодирование;
- Base64, включая анализ подстрок соответствующего синтаксиса;
- Escape-последовательности Unicode, CSS, JavaScript;
- String from CharCode, CodePoint функции;
- HTML-кодирование.
- Скачайте файл из секции Release;
- Распакуйте архив;
- В Google Chrome включите режим разработчика в меню расширений;
- После перехода к меню выбора укажите директорию;
- Если необходимо провести отладку на каких-либо полезных нагрузках используйте функцию test(filename).