- 先清除瀏覽器的cookie金吗,然后打開DVWA并抓包庶近,發(fā)現(xiàn)此時(shí)瀏覽器發(fā)出的請求中是不帶有session id的:
GET / HTTP/1.1
Host: 192.168.180.128:2333
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close - 該請求得到的response為:
HTTP/1.1 302 Found
Date: Tue, 17 Apr 2018 06:01:40 GMT
Server: Apache/2.4.18 (Ubuntu)
Set-Cookie: PHPSESSID=qk84l7glm7qgck0aebi0gmpue4; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: PHPSESSID=qk84l7glm7qgck0aebi0gmpue4; path=/; HttpOnly
Set-Cookie: security=impossible; HttpOnly
Location: login.php
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8
可以看到服務(wù)器返回的數(shù)據(jù)中帶上了session id齐遵,說明此session id是服務(wù)器產(chǎn)生并發(fā)送給瀏覽器的。
session id:qk84l7glm7qgck0aebi0gmpue4 - 然后瀏覽器發(fā)送的GET請求中就帶上了這個(gè)session id:
GET /login.php HTTP/1.1
Host: 192.168.180.128:2333
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: PHPSESSID=qk84l7glm7qgck0aebi0gmpue4; security=impossible
Connection: close - 輸入用戶名和密碼之后沼死,瀏覽器發(fā)出的POST請求為:
POST /login.php HTTP/1.1
Host: 192.168.180.128:2333
Content-Length: 88
Cache-Control: max-age=0
Origin: http://192.168.180.128:2333
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
Referer: http://192.168.180.128:2333/login.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: PHPSESSID=qk84l7glm7qgck0aebi0gmpue4; security=impossible
Connection: close
username=admin&password=password&Login=Login&user_token=ae346fee479c2d5f7f0c8c80fc4f9a65
此處的user_token為:ae346fee479c2d5f7f0c8c80fc4f9a65
再發(fā)出幾次請求后阁吝,user token發(fā)生了變化:
POST /security.php HTTP/1.1
Host: 192.168.180.128:2333
Content-Length: 78
Cache-Control: max-age=0
Origin: http://192.168.180.128:2333
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
Referer: http://192.168.180.128:2333/security.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: PHPSESSID=qk84l7glm7qgck0aebi0gmpue4; security=impossible
Connection: close
security=high&seclev_submit=Submit&user_token=a69e4f83d036dbf9f22cb49a96783fdc