일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- speed-measure-webpack-plugin
- ue4dumper
- 척추관협착증
- ssrf
- 거래사기
- 네이버카페
- 많다..
- 보이스피싱 #대검찰청 #명의도용 #비밀번호 #계좌번호 #공공기관 #가짜검찰청
- MongoDB #NoSQL #CreateUser #DropUser #mongod #mognod.conf
- Frida
- shell_gpt
- 허리디스크
- 로맨스스캠
- 중고나라
- 변태는
- CryptoJS
- 안전결제
- 모의해킹
- self-signed
- intelmac
- 취약점
- esbuild
- XSS
- 채팅환전사기
- NUGU
- react
- CJ대한통운 #쿠팡 #통관번호오류 #통관고유번호오류 #안주원팀장 #모건인베스트
- Sequoia
- open redirect
- Malware Sample
Archives
- Today
- Total
annyoung
Overriding getter and setter on document.cookie 본문
var old_cookie = document.cookie;
Object.defineProperty(document, 'cookie', {
get: function() {
console.log('Getting cookie');
return this._value;
},
set: function(val) {
console.log('Setting cookie', arguments);
this._value = val;
return this._value;
}
});
document.cookie = old_cookie;
javascript에서 object에서 getter와 setter를 사용할 수 있는데, 이를 통해 cookie 리시버를 할 수 있지 않을까 생각해보았는데 실제로 코드가 존재했다. https://stackoverflow.com/questions/18317202/defining-a-getter-for-document-cookie#answer-20203840
하지만, getter와 setter 속성을 추가하는 경우 이전에 사용하던 쿠키값이 지워지므로 1번라인과 마지막 라인을 추가해준 것으로 확인된다.
클라이언트나 웹뷰에서 set 하는 경우 리시버 역할을 하기 때문에 디버깅하기 수월할 것으로 판단된다.
단, 웹뷰 객체가 생성되고 executeJavaScript로 실행 후 loadUrl을 통해 웹뷰를 로드하는 경우 리시버가 정상적으로 동작하지 않을 수 있다.
// If call the window.close(), then return false
window.close = () => {
return false;
}
// If call the self.close(), then return false
self.close = () => {
return false;
}
이전에 call function에 오버라이딩 해야하는 상황이 생기면 위와 같이 오버라이딩을 해서 window가 닫히지 않도록 구현했었는데, getter와 setter를 통해 receive 하는 방식도 가능한 것 같다.
document.cookie 자체가 네이티브라 getter와 setter로 오버라이딩할 생각을 못했는데 혹시나하고 찾아봤는데 역시 생각한건 이미 만들어져있는 세상인걸 새삼 느끼고 간다.
* 220905 추가: 생각해보니까 차라리 frida hooking해서 보는게 더 편할것 같긴하다.
'모의해킹' 카테고리의 다른 글
모의해킹 시 해시(hash)에 대해 (0) | 2022.11.22 |
---|---|
Deeplink webview hijacking 취약점 분석 (0) | 2022.09.21 |
file upload curl to Insomnia api debugger (0) | 2022.07.06 |
XSS와 꿀팁(?)에 대해서 (0) | 2022.06.30 |
iOS pinning bypass with frida (1) | 2022.05.20 |
Comments