[SQL Injection] Prepared Statement 적용이 불가한 구문일 때
·
Security/Application
보통 SQL 인젝션을 막기 위한 가장 효과적인 방법 중 하나로 Prepared Statement가 널리 알려져 있습니다. 저 역시 이렇게 알고 있었지만, 모든 것을 막을 순 없었습니다. 쿼리 구조를 동적으로 변경해야 하는 특정 구문에는 적용할 수 없다는 한계가 있습니다. 특히, ORDER BY 절이 그 대표적인 예시인데요. 이번 글에서는 Prepared Statement로 막을 수 없는 ORDER BY 절 SQL 인젝션의 원인과 안전한 방어 대책에 대해서 작성해 보려고 합니다. 1. 취약 원인ORDER BY 절은 정렬 기준 컬럼(식별자)을 지정하는 구문입니다. 이 컬럼명은 실행 시점에 동적으로 결정되므로, Prepared Statement(이하 PS)의 *리터럴 바인딩 방식을 적용할 수 없습니다. PS..
Active Directory(AD)
·
카테고리 없음
보안을 공부하면서 Active Directory(이하 AD)는 꼭 짚고 넘어가야 할 핵심 인프라라는 걸 느꼈습니다. AD는 단순히 로그인만 처리하는 시스템이 아니라, 도메인 기반 인증, 정책 적용, 권한 관리, 그리고 인증서 발급 시스템까지 모두 통합되어 있는 구조입니다. 기업이나 조직의 규모가 커질수록 AD의 중요성은 더 커지고, 동시에 공격자 입장에서는 가장 먼저 노리고 싶은 자산이 되기도 합니다.이 글은 보안 공부를 하면서 AD의 구조와 인증 방식, 내부 탐색 구조(LDAP), 인증서 기반 보안, 그리고 krbtgt 계정과 Golden Ticket까지 보안 관점에서 알아야 할 요소들을 정리한 내용입니다.1. Active Directory란?Active Directory(이하 AD)는 Microsof..
스프링 부트 앱, 도커로 빌드하고 EC2에 배포하기
·
Dev
이번 게시글은 스프링 부트(Spring Boot) 프로젝트를 도커(Docker) 이미지로 만들고, 이를 Docker Hub에 푸시한 다음, EC2 인스턴스에 배포하는 과정을 기록해 두려고 합니다.1. Spring boot 프로젝트 빌드 및 .jar 파일 생성먼저, 스프링 부트 프로젝트를 빌드하여 실행 가능한 .jar 파일을 생성해야 합니다. 프로젝트 루트 디렉터리에서 다음 명령어를 실행합니다../gradlew clean build 성공적으로 실행되면, 프로젝트의 build/lib 디렉토리 안에 [프로젝트 이름].jar와 같은 실행 가능한 JAR 파일이 생성됩니다.2. Docker 이미지 빌드 및 태그 저장이제 생성된 JAR 파일을 기반으로 도커 이미지를 만들어 보겠습니다. 도커 이미지는 애플리케이션과 모..
[AWS] 오픈소스 도구를 통한 취약점 진단 (with ScoutSuite)
·
Security/Cloud
클라우드 오픈소스 도구를 통한 취약점 진단 파이썬, 깃 설치aws cli 설치액세스 키 생성 그 다음 C드라이브 밑에 ScoutSuite 폴더를 생성합니다. 그리고 깃배쉬에서 아래 명령어 입력해서 깃 클론을 한다.git clone https://github.com/nccgroup/ScoutSuite 해당 폴더의 경로로 cmd를 이동한다. ScoutSuite 도구 설치 및 사용가상환경 설치 및 실행C:\ScoutSuite\ScoutSuite>python -m venv aws_venvC:\ScoutSuite\ScoutSuite>cd aws_venvC:\ScoutSuite\ScoutSuite\aws_venv>cd ScriptsC:\ScoutSuite\ScoutSuite\aws_venv\Scripts>actia..
[Path traversal] File path traversal, traversal sequences stripped with superfluous URL-decode
·
Web Security Academy
This lab contains a path traversal vulnerability in the display of product images.The application blocks input containing path traversal sequences. It then performs a URL-decode of the input before using it.To solve the lab, retrieve the contents of the /etc/passwd file.https://portswigger.net/web-security/file-path-traversal/lab-superfluous-url-decode Lab: File path traversal, traversal sequenc..
[File upload] Web shell upload via extension blacklist bypass
·
Web Security Academy
This lab contains a vulnerable image upload function. Certain file extensions are blacklisted, but this defense can be bypassed due to a fundamental flaw in the configuration of this blacklist.To solve the lab, upload a basic PHP web shell, then use it to exfiltrate the contents of the file /home/carlos/secret. Submit this secret using the button provided in the lab banner.You can log in to your..
[File upload] Remote code execution via web shell upload
·
Web Security Academy
This lab contains a vulnerable image upload function. It doesn't perform any validation on the files users upload before storing them on the server's filesystem.To solve the lab, upload a basic PHP web shell and use it to exfiltrate the contents of the file /home/carlos/secret. Submit this secret using the button provided in the lab banner.You can log in to your own account using the following c..
[Docker] 컨테이너 기반의 로드밸런싱 구축
·
Security
이번 실습에서는 Docker 컨테이너를 활용하여 3개의 웹 서버를 구축하고, Kali Linux에 Nginx를 설치해 로드 밸런싱을 구현하는 과정을 정리해 보겠습니다. 각 웹 서버는 서로 다른 index.html을 제공하고, 이를 로드 밸런서를 통해 순차적으로 접속할 수 있도록 설정합니다.1. 목표Docker로 웹 서버 컨테이너 3개 생성 (web01, web02, web03)각 웹 서버는 서로 다른 index.html 페이지를 가짐Kali Linux에 Nginx 설치 후 로드 밸런서 역할 수행Nginx의 nginx.conf를 수정하여 로드 밸런싱 구현볼륨 마운트를 이용하여 컨테이너에 HTML 파일 연결 2. 웹 서버 구성 방법 (호스트 디렉터리를 마운트)* 웹 서버를 구성할 때 호스트 디렉터리를 마운트..