[2학기 2주차] 웹 해킹 문제 풀이
<Webhacking HTTP-Cookies>
https://www.root-me.org/en/Challenges/Web-Server/HTTP-Cookies
이메일을 입력했더니 saved email adresses라는 문구가 떴다. 그래서 페이지 소스코드를 분석하기로 했다.
admin계정이 필요한 상태다.
<br/>
<br/>
<fieldset>
<form method="POST" action="" name="a">
Email<br/>
<input type="text" name="mail" size="20" class="post2" value=""><br/><br/>
<input type="submit" name="jsep4b" size="20" class="post2" value="send"><br/><br/>
</form><!--SetCookie("ch7","visiteur");--><a href="?c=visiteur">Saved email adresses</a><br/></fieldset>
굵게 표시한 부분이 admin이 아니라 visiteur로 되어있다. editthiscookie라는 프로그램을 사용해서 쿠키값을 admin으로 바꿔준다.
변경한 뒤 버튼을 누르면 바로 패스워드 값을 얻을 수 있다.
< Root Me, Javascript - Authentication 2>
https://www.root-me.org/en/Challenges/Web-Client/Javascript-Authentication-2
Challenges/Web - Client : Javascript - Authentication 2 [Root Me : Hacking and Information Security learning platform]
TCP - Back to school just blocks when i try to read the flag after i have sent the calculation. Not sure if my calculation is wrong or what is is?
www.root-me.org
로그인 버튼을 누르면 password 입력 창이 뜬다.
function connexion(){
var username = prompt("Username :", "");
var password = prompt("Password :", "");
var TheLists = ["GOD:HIDDEN"];
for (i = 0; i < TheLists.length; i++)
{
if (TheLists[i].indexOf(username) == 0)
{
var TheSplit = TheLists[i].split(":");
var TheUsername = TheSplit[0];
var ThePassword = TheSplit[1];
if (username == TheUsername && password == ThePassword)
{
alert("Vous pouvez utiliser ce mot de passe pour valider ce challenge (en majuscules) / You can use this password to validate this challenge (uppercase)");
}
}
else
{
alert("Nope, you're a naughty hacker.")
}
}
}
개발자 모드를 켜서 login.js 파일을 분석한 결과
var TheLists = ["GOD:HIDDEN"]; 인 것을 알 수 있다.
if 구문을 보면 아이디와 패스워드는 각각 split 되어 god, hidden임을 알 수 있다.
따라서 이를 각각 아이디 비번에 입력하면 로그인에 성공한다.
<Root me, Javascript - Webpack>
https://www.root-me.org/en/Challenges/Web-Client/Javascript-Webpack
Challenges/Web - Client : Javascript - Webpack [Root Me : Hacking and Information Security learning platform]
TCP - Back to school just blocks when i try to read the flag after i have sent the calculation. Not sure if my calculation is wrong or what is is?
www.root-me.org
사이트의 메인 화면에서는 오리와 원앙을 구별해야 한다고 말한다. 개발자 모드를 눌러 코드를 확인해보니
전체 코드를 다 확인할 수 있었다. 특별해 보이는 파일을 찾아 여러군데 뒤적였더니 src > components 파일 밑에 긴 이름의 파일이 있었다.
1번 파일
function injectStyle (ssrContext) {
require("!!../../node_modules/extract-text-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!vue-style-loader!css-loader?{\"sourceMap\":true}!../../node_modules/vue-loader/lib/style-compiler/index?{\"vue\":true,\"id\":\"data-v-4b9752b8\",\"scoped\":true,\"hasInlineConfig\":false}!../../node_modules/vue-loader/lib/selector?type=styles&index=0!./YouWillNotFindThisRouteBecauseItIsHidden.vue")
}
var normalizeComponent = require("!../../node_modules/vue-loader/lib/component-normalizer")
/* script */
export * from "!!babel-loader!../../node_modules/vue-loader/lib/selector?type=script&index=0!./YouWillNotFindThisRouteBecauseItIsHidden.vue"
import __vue_script__ from "!!babel-loader!../../node_modules/vue-loader/lib/selector?type=script&index=0!./YouWillNotFindThisRouteBecauseItIsHidden.vue"
/* template */
import __vue_template__ from "!!../../node_modules/vue-loader/lib/template-compiler/index?{\"id\":\"data-v-4b9752b8\",\"hasScoped\":true,\"transformToRequire\":{\"video\":[\"src\",\"poster\"],\"source\":\"src\",\"img\":\"src\",\"image\":\"xlink:href\"},\"buble\":{\"transforms\":{}}}!../../node_modules/vue-loader/lib/selector?type=template&index=0!./YouWillNotFindThisRouteBecauseItIsHidden.vue"
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-4b9752b8"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__vue_script__,
__vue_template__,
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
export default Component.exports
2번 파일
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _vm._m(0)}
var staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('main',[_c('div',{staticClass:"home-page"},[_c('div',{staticClass:"block"},[_c('h1',[_vm._v("This a mandarin duck ! ")]),_vm._v(" "),_c('p',{staticClass:"intro"},[_vm._v("It is a mandarin duck !!!!! As you can see, it is much more beautiful than a normal duck.")]),_vm._v(" "),_c('h2',[_vm._v("DO NOT EAT THIS ONE !")])]),_vm._v(" "),_c('div',{staticClass:"block"},[_c('img',{attrs:{"src":"/static/duck-mandarin.png"}})])])])}]
var esExports = { render: render, staticRenderFns: staticRenderFns }
export default esExports
//////////////////
// WEBPACK FOOTER
// ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-4b9752b8","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/components/YouWillNotFindThisRouteBecauseItIsHidden.vue
// module id = null
// module chunks =
render 함수 말고는 아는 부분이 없고 아직까진 중요해보이는 내용은 없다.
webpackJsonp([0], {
"0qD8": function(t, a) {},
Gz79: function(t, a) {},
JAfz: function(t, a) {},
NHnr: function(t, a, n) {
"use strict";
Object.defineProperty(a, "__esModule", {
value: !0
});
var s = n("7+uW")
, i = {
render: function() {
var t = this.$createElement
, a = this._self._c || t;
return a("div", {
attrs: {
id: "app"
}
}, [a("div", {
staticClass: "wrapper"
}, [a("header", {
staticClass: "site-header"
}, [a("nav", [a("strong", [this._v("Quack Quack ! | ")]), this._v(" "), a("router-link", {
attrs: {
to: "/duck"
}
}, [this._v("Duck")]), this._v(" or\n "), a("router-link", {
attrs: {
to: "/duck-mandarin"
}
}, [this._v("Mandarin duck")])], 1)]), this._v(" "), a("router-view")], 1)])
},
staticRenderFns: []
};
var e = n("VU/8")({
name: "App"
}, i, !1, function(t) {
n("Ui3U")
}, null, null).exports
, c = n("/ocq")
, r = {
render: function() {
this.$createElement;
this._self._c;
return this._m(0)
},
staticRenderFns: [function() {
var t = this.$createElement
, a = this._self._c || t;
return a("main", [a("div", {
staticClass: "home-page"
}, [a("div", {
staticClass: "block"
}, [a("h1", [this._v("Welcome ! ")]), this._v(" "), a("p", {
staticClass: "intro"
}, [this._v("If you are here, it means that you don't know the difference between a duck and mandarin duck.")]), this._v(" "), a("h2", [this._v("Shame on you !")])]), this._v(" "), a("div", {
staticClass: "block"
})])])
}
]
};
var u = n("VU/8")({
name: "Home",
data: function() {
return {}
}
}, r, !1, function(t) {
n("JAfz")
}, "data-v-5c6c3158", null).exports
, o = {
render: function() {
this.$createElement;
this._self._c;
return this._m(0)
},
staticRenderFns: [function() {
var t = this.$createElement
, a = this._self._c || t;
return a("main", [a("div", {
staticClass: "home-page"
}, [a("div", {
staticClass: "block"
}, [a("h1", [this._v("This a normal duck ! ")]), this._v(" "), a("p", {
staticClass: "intro"
}, [this._v("It is just a duck... You can eat this one.")])]), this._v(" "), a("div", {
staticClass: "block"
}, [a("img", {
attrs: {
src: "static/duck.png"
}
})])])])
}
]
};
var h = n("VU/8")({
name: "Duck",
data: function() {
return {}
}
}, o, !1, function(t) {
n("Gz79")
}, "data-v-1a7d2945", null).exports
, d = {
render: function() {
this.$createElement;
this._self._c;
return this._m(0)
},
staticRenderFns: [function() {
var t = this.$createElement
, a = this._self._c || t;
return a("main", [a("div", {
staticClass: "home-page"
}, [a("div", {
staticClass: "block"
}, [a("h1", [this._v("This a mandarin duck ! ")]), this._v(" "), a("p", {
staticClass: "intro"
}, [this._v("It is a mandarin duck !!!!! As you can see, it is much more beautiful than a normal duck.")]), this._v(" "), a("h2", [this._v("DO NOT EAT THIS ONE !")])]), this._v(" "), a("div", {
staticClass: "block"
}, [a("img", {
attrs: {
src: "static/duck-mandarin.png"
}
})])])])
}
]
};
var l = n("VU/8")({
name: "Duck",
data: function() {
return {}
}
}, d, !1, function(t) {
n("0qD8")
}, "data-v-bb84558a", null).exports
, v = {
render: function() {
this.$createElement;
this._self._c;
return this._m(0)
},
staticRenderFns: [function() {
var t = this.$createElement
, a = this._self._c || t;
return a("main", [a("div", {
staticClass: "home-page"
}, [a("div", {
staticClass: "block"
}, [a("h1", [this._v("This a mandarin duck ! ")]), this._v(" "), a("p", {
staticClass: "intro"
}, [this._v("It is a mandarin duck !!!!! As you can see, it is much more beautiful than a normal duck.")]), this._v(" "), a("h2", [this._v("DO NOT EAT THIS ONE !")])]), this._v(" "), a("div", {
staticClass: "block"
}, [a("img", {
attrs: {
src: "/static/duck-mandarin.png"
}
})])])])
}
]
};
n("VU/8")({
name: "Duck",
data: function() {
return {
msg: "Quack quack !! :)."
}
}
}, v, !1, function(t) {
n("TNCB")
}, "data-v-4b9752b8", null).exports;
s.a.use(c.a);
var m = new c.a({
routes: [{
path: "/",
name: "Home",
component: u
}, {
path: "/duck",
name: "Duck",
component: h
}, {
path: "/duck-mandarin",
name: "DuckMandarin",
component: l
}]
});
s.a.config.productionTip = !1,
new s.a({
el: "#app",
router: m,
components: {
App: e
},
template: "<App/>"
})
},
TNCB: function(t, a) {},
Ui3U: function(t, a) {}
}, ["NHnr"]);
//# sourceMappingURL=app.a92c5074dafac0cb6365.js.map
아무거나 눌러보다 밑에 from app~js.map 코드를 발견했다. app.a92c5074dafac0cb6365.js.map을 입력해 보았는데 아무것도 뜨지 않았다. 더 고민 해봐야겠다.
<webhacking.kr, old-12>
https://webhacking.kr/challenge/code-3/
Challenge 12
webhacking.kr
자바 스크립트 챌린지라고 써있는 걸 보니 역시 개발자 도구를 이용하는 문제 같다.
이를 통해 살펴보니 많은 양의 이모티콘이 들어있다. 다만 배경이 까만 색이어서 안 보이는 것 같다. 자바스크립트와 이모티콘의 상관관계에 대해 찾아보니 aaencode라는 스크립트 난독화 기법이 사용되었다.
https://cat-in-136.github.io/2010/12/aadecode-decode-encoded-as-aaencode.html
aadecode - Decode encoded-as-aaencode JavaScript program. ['_']
aadecode - Decode encoded-as-aaencode JavaScript program. (゚Д゚) ['_'] Enter ...
cat-in-136.github.io
플래그 값 youaregod~~~~~~!을 확인할 수 있다.