Skip to content
KitploitKITPLOIT
도구익스플로잇블로그
Log in
제출
도구익스플로잇블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

피드문의개인정보© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
js-xss — Whitelist로 지정된 구성으로 신뢰할 수 없는 HTML을 정화합니다(XSS 방지). | Kitploit
도구/GitHubGitHub/leizongmin/js-xss
Defensive ToolsWeb Application ExploitationWeb SecurityUtilities & Frameworks
GitHubleizongmin/js-xss

js-xss

Whitelist로 지정된 구성으로 신뢰할 수 없는 HTML을 정화합니다(XSS 방지).

저장소 보기
5.3k6302026년 10월 24일Kitploit 검토 완료
공유
웹사이트

NPM version Node.js CI Test coverage David deps node version npm download npm license

화이트리스트로 지정된 설정을 사용하여 신뢰할 수 없는 HTML을 정화합니다(XSS 방지).

Greenkeeper badge

xss


xss는 XSS 공격을 방지하기 위해 사용자 입력을 필터링하는 데 사용되는 모듈입니다. (XSS 공격이란 무엇인가요?)

프로젝트 홈페이지: http://jsxss.com

온라인에서 사용해 보기: http://jsxss.com/en/try.html

中文版文档


기능

  • 화이트리스트를 통해 허용되는 HTML 태그와 해당 속성을 지정합니다
  • 사용자 정의 함수를 사용하여 모든 태그나 속성을 처리합니다.

참고 자료

  • XSS 필터 우회 치트 시트
  • Data URI 스킴
  • Data URI 스킴을 이용한 XSS

벤치마크 (참고용)

  • xss 모듈: 22.53 MB/s
  • 모듈 [email protected]의 xss() 함수: 6.9 MB/s

테스트 코드는 benchmark 디렉터리를 참조하세요.

xss 모듈을 사용하는 곳

  • nodeclub - MongoDB를 사용하는 Node.js bbs - https://github.com/cnodejs/nodeclub
  • cnpmjs.org - 기업용 프라이빗 npm 레지스트리 및 웹 - https://github.com/cnpm/cnpmjs.org
  • cocalc.com - 협업 계산 및 데이터 과학 - https://cocalc.com

설치

NPM

npm install xss

Bower

bower install xss

또는

bower install https://github.com/leizongmin/js-xss.git

사용법

Node.js에서

var xss = require("xss");
var html = xss('<script>alert("xss");</script>');
console.log(html);

정제된 HTML 및 제거된 요소 가져오기

filterXSSWithResult를 사용하면 정제된 HTML과 제거된 태그/속성 목록을 모두 가져올 수 있습니다:

var xss = require("xss");
var result = xss.filterXSSWithResult('<script>alert("xss");</script><a href="#" onclick="evil()">click</a>');
console.log(result.html);
// Output: "&lt;script&gt;alert(\"xss\");&lt;/script&gt;<a href=\"#\">click</a>"
console.log(result.removed);
// Output: [
//   { type: "tag", tag: "script", html: "<script>", isClosing: false },
//   { type: "tag", tag: "script", html: "</script>", isClosing: true },
//   { type: "attr", tag: "a", attr: "onclick", value: "evil()" }
// ]

브라우저에서

Shim 모드 (참조 파일 test/test.html):

<script src="https://rawgit.com/leizongmin/js-xss/master/dist/xss.js"></script>
<script>
  // apply function filterXSS in the same way
  var html = filterXSS('<script>alert("xss");</scr' + "ipt>");
  alert(html);
</script>

AMD 모드 - shim:

<script>
  require.config({
    baseUrl: "./",
    paths: {
      xss: "https://rawgit.com/leizongmin/js-xss/master/dist/xss.js",
    },
    shim: {
      xss: { exports: "filterXSS" },
    },
  });
  require(["xss"], function (xss) {
    var html = xss('<script>alert("xss");</scr' + "ipt>");
    alert(html);
  });
</script>

참고: 프로덕션 환경에서는 https://rawgit.com/leizongmin/js-xss/master/dist/xss.js URL을 사용하지 마십시오.

명령줄 도구

파일 처리

xss 명령줄 도구를 사용하여 파일을 처리할 수 있습니다. 사용법:

xss -i <input_file> -o <output_file>

예시:

xss -i origin.html -o target.html

활성 테스트

다음 명령을 실행하면 명령줄에 HTML 코드를 입력할 수 있으며, 필터링된 출력을 확인할 수 있습니다:

xss -t

자세한 내용은 $ xss -h을 실행하여 확인하세요.

사용자 정의 필터 규칙

xss() 함수를 사용할 때 두 번째 매개변수를 사용하여 사용자 정의 규칙을 지정할 수 있습니다:

options = {}; // Custom rules
html = xss('<script>alert("xss");</script>', options);

매번 options를 전달하지 않으려면, FilterXSS 인스턴스를 생성하여 더 빠르게 처리할 수도 있습니다:

options = {}; // Custom rules
myxss = new xss.FilterXSS(options);
// then apply myxss.process()
html = myxss.process('<script>alert("xss");</script>');

options의 매개변수 세부 사항은 아래에서 설명합니다.

화이트리스트

whiteList을 지정하면, 예를 들어 { 'tagName': [ 'attr-1', 'attr-2' ] }와 같이 지정할 수 있습니다. 화이트리스트에 없는 태그와 속성은 필터링되어 제거됩니다. 예를 들어:

// only tag a and its attributes href, title, target are allowed
var options = {
  whiteList: {
    a: ["href", "title", "target"],
  },
};
// With the configuration specified above, the following HTML:
// <a href="#" onclick="hello()"><i>Hello</i></a>
// would become:
// <a href="#">&lt;i&gt;Hello&lt;/i&gt;</a>

기본 화이트리스트는 xss.whiteList를 참조하세요.

allowList도 지원되며, whiteList와 동일한 기능을 합니다.

일치하는 태그에 대한 핸들러 함수 사용자 정의

onTag로 핸들러 함수를 지정하여:

function onTag(tag, html, options) {
  // tag is the name of current tag, e.g. 'a' for tag <a>
  // html is the HTML of this tag, e.g. '<a>' for tag <a>
  // options is some addition informations:
  //   isWhite    boolean, whether the tag is in whitelist
  //   isClosing  boolean, whether the tag is a closing tag, e.g. true for </a>
  //   position        integer, the position of the tag in output result
  //   sourcePosition  integer, the position of the tag in input HTML source
  // If a string is returned, the current tag would be replaced with the string
  // If return nothing, the default measure would be taken:
  //   If in whitelist: filter attributes using onTagAttr, as described below
  //   If not in whitelist: handle by onIgnoreTag, as described below
}

일치하는 태그의 속성에 대한 핸들러 함수 사용자 지정

onTagAttr로 핸들러 함수를 지정하여:

function onTagAttr(tag, name, value, isWhiteAttr) {
  // tag is the name of current tag, e.g. 'a' for tag <a>
  // name is the name of current attribute, e.g. 'href' for href="#"
  // isWhiteAttr whether the attribute is in whitelist
  // If a string is returned, the attribute would be replaced with the string
  // If return nothing, the default measure would be taken:
  //   If in whitelist: filter the value using safeAttrValue as described below
  //   If not in whitelist: handle by onIgnoreTagAttr, as described below
}

화이트리스트에 없는 태그에 대한 핸들러 함수 사용자 지정

onIgnoreTag로 핸들러 함수를 지정하여:

function onIgnoreTag(tag, html, options) {
  // Parameters are the same with onTag
  // If a string is returned, the tag would be replaced with the string
  // If return nothing, the default measure would be taken (specifies using
  // escape, as described below)
}

화이트리스트에 없는 속성에 대한 핸들러 함수 사용자 지정

onIgnoreTagAttr로 핸들러 함수를 지정하여:

function onIgnoreTagAttr(tag, name, value, isWhiteAttr) {
  // Parameters are the same with onTagAttr
  // If a string is returned, the value would be replaced with this string
  // If return nothing, then keep default (remove the attribute)
}

HTML용 이스케이프 함수 사용자 정의

escapeHtml로 핸들러 함수를 지정하여 사용자 정의할 수 있습니다. 다음은 기본 함수입니다 (수정은 권장하지 않음):

function escapeHtml(html) {
  return html.replace(/</g, "&lt;").replace(/>/g, "&gt;");
}

속성 값에 대한 이스케이프 함수 사용자 지정

기본 safeAttrValue는 사용자 지정 화이트리스트에 의해 해당 속성이 허용될 때 action 및 formaction도 검사합니다. 폼 대상은 HTTP(S) 또는 상대 URL(경로, 쿼리, 프래그먼트 포함)을 사용할 수 있으며, javascript: 및 data:를 포함한 다른 스킴은 거부됩니다. href 및 src에 대한 data:image/ 예외는 폼 대상에는 적용되지 않습니다.

safeAttrValue로 핸들러 함수를 지정하여:

도구 다운로드

관련 도구

  • wazuh

    엔드포인트 및 클라우드 워크로드 전반의 위협 탐지, 로그 분석, 파일 무결성 모니터링, 취약점 평가 및 규정 준수 관리를 위한 오픈소스 XDR 및 SIEM 플랫폼입니다.

  • suricata

    실시간 트래픽 검사, 침입 탐지 및 차단, 프로토콜 분석, 규칙 기반 위협 헌팅을 위한 오픈소스 네트워크 IDS/IPS/NSM 엔진입니다.

  • zeek

    Zeek는 일반적인 IDS와는 매우 다른 강력한 네트워크 분석 프레임워크입니다.

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

  • 1

    Callisto

    jetp1ane/callisto

    Ghidra를 통해 실행 파일을 디컴파일하고, Semgrep으로 의사 C 코드를 스캔하며, GPT-3.5-Turbo를 사용하여 결과를 검증해 거짓 양성을 줄이는 자동화된 바이너리 취약점 분석 도구입니다.

    2.2k
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    # GhostLock 원탭 실행 앱 (CVE-2026-43499)

    841
  • 3

    DFRoot

    a2333c/dfroot

    삼성 Galaxy S25 Ultra(SM-S938B)용 Android 루트 도구로, DirtyFrag CVE-2026-43284와 CVE-2026-43499를 연쇄하여 KernelSU를 통해 부팅 시 자동으로 루트 권한을 획득합니다.

    446
  • 4

    ARTEX

    baarai/artex

    LLM 멀티 에이전트 자율 침투 테스트 플랫폼으로, 플래너/워커 에이전트, 자산 및 탐색 그래프, MITM 트래픽 기록, 취약점 재테스트 기능을 제공합니다.

    386
  • 5

    OsintHunter

    letox4/osinthunter

    🎯 궁극의 OSINT 툴킷: 조사 그래프, 신뢰도 점수 산정, 별칭 패밀리, 지도, 타임라인 및 보고서. 49개 모듈, 400개 이상 사이트, API 키 불필요.

    350
  • 6

    faraday

    infobyte/faraday

    공격적 보안, 취약점 관리, 자율 펜테스팅을 위한 오픈소스 및 AI 기반 사이버보안 도구. 라틴 아메리카의 해커들이 만들고 전 세계에서 사용됩니다.

    333

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →