cookie === **架設:** win7 1.安装OpenSSH服务,下載7.7之前的版本,方便配置 > [PowerShell/Win32-OpenSSH](https://"github.com/PowerShell/Win32-OpenSSH/releases") 2.下載最新 OpenSSH-Win64.zip(64位系统),解壓至C:\Program Files\OpenSSH 3.**執行系統管理者**打開cmd,cd進入C:\Program Files\OpenSSH(安裝目錄) 執行命令: > powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1 >  4.設置服务自動啟動開啟服務: > sc config sshd start= auto > net start sshd >  5.xampp install 6.http.conf setting (路徑、port) ### Source index.html ```php= <html> <body> <form method="post" enctype="multipart/form-data" action="echo.php"> Username-<input type="text" name="user"/><br> Password-<input type="Password" name="passwd"/><br> <input type="submit" value="Login"/> <br>touch me !! </form> </body> </html> ``` echo.php ```php= <?php $name=$_POST["user"]; $passwd=$_POST["passwd"]; if ($name !="123456" or $passwd !="babygirl") { echo $name. " Error ! non-existent"; $value = base64_encode('username-apollo-password-1qaz@WSX'); setcookie("SSH", $value); exit; }else { echo $name. " Success!!yummy cookie!!"; } ?> ``` **手法:** 1.Scan >nmap -sS -sV target  2.dircovery 不管輸入什麼,記得吃餅乾  base64解密 (username-johnny-password-1qaz@WSX)  hydra 爆破也行 (看難易度更改,使用hydra) >hydra -t 3 -L 字典(rockyou.txt) -P 字典(rockyou.txt) -vV -f "target" -s "port" http-post-form "/"跳轉網頁":user=\^USER\^&passwd=\^PASS\^:錯誤訊息" ==-t 線程數、-l 帳號、-L 字典、-p 密碼、-P 字典、-vV 逐行顯示、-f 執行到有停止、 -s 指定port、user(html title)、passwd(html title)==  hydra 爆破密碼 get username password (看難易度更改) username:123456 password:babygirl 3.get ssh username password to connect **防禦:** 1.WIN7本身漏洞永恆之藍 [關閉相對應口]("https://kknews.cc/zh-tw/tech/rz9858r.html") 2.cookie含有ssh資訊 改掉user&passw 3.遠端port22 [阻擋方式](https://"ithelp.ithome.com.tw/articles/10081601") >netsh advfirewall firewall add rule name="禁止 UDP 22 連入" protocol=UDP dir=out localport=22 action=block 避免對方可能還在使用中,以下指令強制停止使用 >taskkill /f /t /im sshd.exe
×
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