논문 해설
RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls
RAT: 웹 애플리케이션 방화벽의 취약점 발견을 위한 강화학습 기반 적응형 테스팅
- 연구 문제 WAF는 공격 패턴이 다양해 블랙박스 테스트의 효율이 낮은 문제가 있으며, RAT는 이를 군집화와 강화학습 기반 적응형 탐색으로 줄이려 합니다.
- 연구 방법 RAT는 공격 페이로드를 n-gram 단편으로 나누고 군집화한 뒤, decayed ϵ-greedy로 군집을 고르고 차단 피드백을 이용하는 적응형 탐색으로 우회 페이로드를 찾습니다.
- 주요 결과 논문은 30,000 요청 안에서 RAT가 ModSecurity와 NAXSI에서 평균 95.37%와 100%의 TPR을 보고하며, 여러 조건에서 기존 방법보다 우수하다고 설명합니다.
웹 응용 방화벽 테스트의 어려움
웹 응용 방화벽(WAF)은 HTTP(S) 트래픽을 분석해 악성 요청을 차단하는 장치이며, 공격 패턴이 매우 다양하고 정교해지면서 주기적으로 테스트하고 갱신해야 합니다. 그러나 가능한 공격 조합을 무차별 대입으로 모두 시험하는 것은 현실적으로 불가능합니다. 이 논문은 SQL 주입(SQLi)과 크로스 사이트 스크립팅(XSS)을 대상으로, 우회에 성공하는 공격 페이로드를 적은 요청 수로 찾는 블랙박스 테스트 방법을 다룹니다.

Fig. 1 : Testing procedure for a WAF to discover vulnerabili- ties. time, due to the massive variety of attacks. Hence, optimal automated testing is essential for WAFs to protect web applications and services efficiently.
원문 · CC BY 4.0 · Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh · RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls · 원문 그림 인용 · 원본 PDF 1쪽에서 그림 영역을 추출했습니다.화이트박스 테스트는 소스 코드 접근이 필요하고 모델 기반 테스트는 보안 정책 모델이 필요하여 현실적 제약이 있습니다. 따라서 블랙박스 테스트가 적용 범위 측면에서 유리하지만, 기존 연구는 많은 요청을 소모하고 여전히 많은 취약점을 놓친다고 논문은 지적합니다.
페이로드 분해와 군집화
RAT는 먼저 공격 페이로드를 n-gram으로 분해합니다. 페이로드를 연속된 N개 토큰 단위의 단편으로 나누어, 토큰 조합으로 더 복잡한 패턴을 표현합니다. 이후 단편을 Word2Vec의 skip-gram으로 학습한 벡터로 바꾸고, 코사인 거리에 기반한 계층적 군집화로 대체 가능한 유사 단편을 하나의 특징으로 묶습니다. 논문은 skip-gram이 희귀 단편을 더 공정하게 학습한다고 설명합니다.
다음으로 각 페이로드가 어떤 군집의 단편을 포함하는지를 이진 벡터로 인코딩합니다. 이 벡터를 오토인코더로 저차원 표현으로 변환한 뒤 k-means로 공격 샘플을 군집화합니다. 논문에서 오토인코더의 손실은 이진 입력에 대한 binary cross-entropy이며, 인코더를 학습한 뒤 디코더를 떼어 내고 인코더 출력을 군집화에 사용합니다.

TABLE 2 : Example of a binary representation for a pay- load p, which shows whether the corresponding payload contains any fragment from the cluster Ci where i is the cluster’s number.
원문 · CC BY 4.0 · Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh · RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls · 원문 그림 인용 · 원본 PDF 5쪽에서 그림 영역을 추출했습니다.
TABLE 6 : Architecture of the AutoEncoder.
원문 · CC BY 4.0 · Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh · RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.적응형 탐색과 ϵ-greedy 군집 선택
군집별 특징 벡터는 각 군집의 유효 단편만 남기고 엔트로피로 반복적이거나 지나치게 드문 단편을 제거한 뒤, IDF 가중치로 구성됩니다. 적응형 탐색(AdaptiveSearch)은 차단된 공격들을 하나의 문서로 보고 후보 페이로드를 질의로 취급하여, 차단된 공격에 많이 나타나는 단편을 포함한 후보의 점수를 높게 계산합니다. 점수가 낮은 후보를 선택하여 WAF에 실행하고, 우회에 성공하면 그 단편을 점수 계산에서 제외합니다.

TABLE 3 : Example of the payloads’ term frequencies in cluster c.
원문 · CC BY 4.0 · Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh · RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.군집 선택에는 decayed ϵ-greedy 정책을 씁니다. 보상은 1, 처벌은 그 절반으로 설정되며, ϵ은 최대 0.9에서 시작해 식 ϵ = max ϵ × e^(−kτ)에 따라 에피소드마다 감소합니다. 논문에서 k는 5e−3이며, 초기에는 탐색을 많이 하고 이후에는 우회 가능성이 있는 군집을 활용하는 구조입니다.
실험 대상과 평가 지표
실험은 오픈소스 WAF인 ModSecurity와 NAXSI, 그리고 교육 서비스를 보호하는 사용자 정의 WAF를 대상으로 수행되었습니다. SQLi 데이터셋은 Ml-Driven E와 비교할 수 있도록 Appelt 등이 제시한 BNF 문법으로 생성되었고, XSS 데이터셋은 dharma 퍼저로 생성되었습니다. 효과성은 TPR로 측정되며, 첫 우회 페이로드를 찾기 전의 FP 수로도 비교합니다. 효율성은 요청당 소요 시간(TSR)으로 측정됩니다.

TABLE 4 : Number of samples in each dataset.
원문 · CC BY 4.0 · Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh · RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.군집 수는 25에서 50 사이에서 실루엣 점수로 정했으며, SQLi는 25개, XSS는 46개로 나누었습니다. 엔트로피 임계값 T는 0.05가 최적으로 보고되었습니다.

Fig. 10 : Silhouette scores for different k in k-means in clustering SQLi and XSS datasets. layers and their size, significantly affect accuracy. Since the way of tuning these parameters is still an open problem [39], we tuned AutoEncoder manually. In the tuning process, we observed that three hidden layers in each encoder and decoder parts are enough, and we could achieve slightly better accuracy by reducing and increasing the size of hid- den layers uniformly. We tend to produce feature vectors with the lowest possible dimensionality for easier and better clustering. In our experiments, we attained a reasonable reconstruction accuracy (95.92% and 96.76% for XSS and SQLi datasets, respectively) by reducing the dimensionality to 3. The final architectures of the AutoEncoders are shown in Table 6.
원문 · CC BY 4.0 · Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh · RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.n-gram과 군집화의 효과
n-gram 비교에서 unigram은 성능이 낮았고, bigram이 trigram보다 약간 더 효율적이었습니다. 저자들은 trigram이 더 복잡한 패턴을 추출하지만 서로 다른 패턴 수가 많아 관찰이 더 많이 필요하다고 해석합니다. 이 비교는 25000개 페이로드 부분집합과 100회 반복, 1000개 요청 기준 평균 TP에 따른 결과입니다.
군집화 효과는 테스트 파라미터 수 감소와 우회 페이로드의 군집 편중이라는 두 측면에서 확인되었습니다. 엔트로피 임계값 t=0.05를 포함할 때 SQLi와 XSS에서 최악의 경우 파라미터를 31.89%와 98.50% 줄였다고 보고됩니다. 또 우회 공격이 소수의 군집에 몰려 있음을 Naxsi와 ModSecurity에 대한 무차별 공격 결과로 보였습니다.

TABLE 7 : Number of test parameters before and after clustering.
원문 · CC BY 4.0 · Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh · RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls · 원문 그림 인용 · 원본 PDF 11쪽에서 그림 영역을 추출했습니다.기준선과의 비교
Ml-Driven E와 Random Fuzzer를 30,000 요청 안에서 비교한 결과, RAT는 ModSecurity와 NAXSI에서 평균 95.37%와 100%의 TPR을 보고했습니다. 최악의 경우에도 83.53%의 우회 페이로드를 찾았다고 보고됩니다. 같은 비교에서 Ml-Driven E의 최선의 경우는 ModSecurity 48.51%, NAXSI 76.56%였습니다. 이 결과는 반복 30회와 Wilcoxon 검정(α=0.05)으로 얻은 것입니다.

TABLE 8 : Result of the Wilcoxon test in testing SQLi vulner- abilities of ModSecurity and NAXSI.
원문 · CC BY 4.0 · Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh · RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls · 원문 그림 인용 · 원본 PDF 12쪽에서 그림 영역을 추출했습니다.첫 우회 페이로드 발견 비교에서는 ART4SQLi와 XSSART를 100회 반복해 FP 수를 측정했습니다. ModSecurity의 쿠키 파라미터에서 RAT는 ART4SQLi보다 평균 61.43% 빠르다고 보고되었습니다. XSS에서는 RAT가 ModSecurity에서 581.45회의 실패 후 첫 우회를 찾았고, NAXSI에서는 제한 시도 안에 찾지 못했다고 보고됩니다.

TABLE 9 : Number of false positives before finding the first SQLi bypassing payload.
원문 · CC BY 4.0 · Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh · RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls · 원문 그림 인용 · 원본 PDF 12쪽에서 그림 영역을 추출했습니다.실환경 결과와 적용 한계
사용자 정의 WAF에서는 인터넷을 통해 30,000개 페이로드를 시험했으며, 실제 응용에서는 전체 우회 수를 알 수 없으므로 TP만 보고되었습니다. 이 실험에서 RAT의 평균 TSR은 0.74초, Ml-Driven E는 0.80초였습니다. 같은 실환경 SQLi 실험에서 Random 전략과 ART4SQLi는 RAT보다 적은 시도로 첫 우회 페이로드를 찾았으며, 논문은 이를 SQLi 취약점이 많은 WAF의 특성 때문일 수 있다고 해석합니다. 반면 XSS에서는 RAT가 XSSART와 Random보다 우수했습니다.

TABLE 10 : The result of comparison between RAT, ART4SQLi, and Random Fuzzer in testing the custom-built WAF for SQLi vulnerabilities. In this table, the mean is the average FP before finding the first bypassing payload.
원문 · CC BY 4.0 · Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh · RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls · 원문 그림 인용 · 원본 PDF 12쪽에서 그림 영역을 추출했습니다.논문은 RAT가 데이터셋의 포괄성에 크게 의존하고 규칙 기반 WAF만 테스트할 수 있으며, ML 기반 WAF를 단독으로 테스트할 수는 없다고 밝힙니다.
논문 정보
- 저자
- Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh
- 학회·저널
- arXiv · 프리프린트
- 최초 공개일
- 2023년 12월 13일
- 등록일
- 2026년 11월 6일
- 수정일
- 2023년 12월 13일
- 버전
- v1
- arXiv
- 2312.07885
- DOI
- 10.1109/tdsc.2021.3095417
- 분류
- cs.CR · cs.AI · cs.IR
- 원문 이용 조건
- CC BY 4.0
- 제공 범위
- 논문 정보, 해설, 허용된 원문 그림
AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.
초록
Due to the increasing sophistication of web attacks, Web Application Firewalls (WAFs) have to be tested and updated regularly to resist the relentless flow of web attacks. In practice, using a brute-force attack to discover vulnerabilities is infeasible due to the wide variety of attack patterns. Thus, various black-box testing techniques have been proposed in the literature. However, these techniques suffer from low efficiency. This paper presents Reinforcement-Learning-Driven and Adaptive Testing (RAT), an automated black-box testing strategy to discover injection vulnerabilities in WAFs. In particular, we focus on SQL injection and Cross-site Scripting, which have been among the top ten vulnerabilities over the past decade. More specifically, RAT clusters similar attack samples together. It then utilizes a reinforcement learning technique combined with a novel adaptive search algorithm to discover almost all bypassing attack patterns efficiently. We compare RAT with three state-of-the-art methods considering their objectives. The experiments show that RAT performs 33.53% and 63.16% on average better than its counterparts in discovering the most possible bypassing payloads and reducing the number of attempts before finding the first bypassing payload when testing well-configured WAFs, respectively.
원문 인용
Mohammadhossein Amouei, Mohsen Rezvani, Mansoor Fateh (2023). RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls. arXiv:2312.07885v1. https://doi.org/10.1109/tdsc.2021.3095417
BibTeX
@article{amouei2023reinforcement,
title = {{RAT: Reinforcement-Learning-Driven and Adaptive Testing for Vulnerability Discovery in Web Application Firewalls}},
author = {Mohammadhossein Amouei and Mohsen Rezvani and Mansoor Fateh},
year = {2023},
eprint = {2312.07885},
archivePrefix = {arXiv},
doi = {10.1109/tdsc.2021.3095417},
url = {https://arxiv.org/abs/2312.07885v1}
}