日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

c++算术溢出_二进制安全之堆溢出(系列)——CTF环境配置

發布時間:2024/10/14 c/c++ 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c++算术溢出_二进制安全之堆溢出(系列)——CTF环境配置 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

【重要通知】知了堂禁衛實驗室全新上線!!
這里有安全體系的學習資源、
最前沿的原創文章、最新的漏洞挖掘原創!!

本期是“二進制安全之堆溢出”系列第一期,主要介紹CTF環境配置。安裝pwntools

  • sudo apt install python-pip python3-pip
  • sudo pip install pwntools
    • 提示安裝python-dev可以使用aptitude安裝
    • 這一步建議掛代理
  • python

>>> import pwn >>> pwn.asm("xor eax,eax") '1xc0' #安裝成功安裝pwndgb

  • git clone https://github.com/pwndbg/pwndbg
  • cd pwndbg
  • ./setup.sh

安裝gef

  • wget -q https://github.com/hugsy/gef/raw/master/gef.py
  • echo "source ~/gef/gef.py" >> ~/.gdbinit

安裝peda

  • git clone https://github.com/longld/peda.git ~/peda
  • echo "source ~/peda/peda.py" >> ~/.gdbinitfile

安裝ROPgadget

  • 用來構建rop鏈
  • git clone https://github.com/JonathanSalwan/ROPgadget.git
  • pip install capstone
  • cd ROPgadget
  • python setup.py install
  • ROPgadget

安裝one_gadget

  • 尋找libc文件中的一些shell地址
  • gem install one_gadget

gdb切換腳本
#!/bin/bash function Mode_change { name=$1 gdbinitfile=/root/.gdbinit #這個路徑按照你的實際情況修改 peda="source ~/peda/peda.py" #這個路徑按照你的實際情況修改 gef="source ~/gef/gef.py" #這個路徑按照你的實際情況修改 pwndbg="source /root/pwndbg/gdbinit.py" #這個路徑按照你的實際情況修改 sign=$(cat $gdbinitfile | grep -n "#this place is controled by user's shell") #此處上面的查找內容要和你自己的保持一致 pattern=":£this place is controled by user's shell" number=${sign%$pattern} location=$[number+2] parameter_add=${location}i parameter_del=${location}d message="TEST" if [ $name -eq "1" ];then sed -i "$parameter_del" $gdbinitfile sed -i "$parameter_add $peda" $gdbinitfile echo -e "Please enjoy the peda!n" elif [ $name -eq "2" ];then sed -i "$parameter_del" $gdbinitfile sed -i "$parameter_add $gef" $gdbinitfile echo -e "Please enjoy the gef!n" else sed -i "$parameter_del" $gdbinitfile sed -i "$parameter_add $pwndbg" $gdbinitfile echo -e "Please enjoy the pwndbg!n" fi } echo -e "Please choose one mode of GDB?n1.peda 2.gef 3.pwndbg" read -p "Input your choice:" num if [ $num -eq "1" ];then Mode_change $num elif [ $num -eq "2" ];then Mode_change $num elif [ $num -eq "3" ];then Mode_change $num else echo -e "Error!nPleasse input right number!" fi gdb $1 $2 $3 $4 $5 $6 $7 $8 $9安裝zsh

  • apt-get install zsh
  • git clone https://github.com/robbyrussell/oh-my-zsh.git
  • cd oh-my-zsh/tools
  • ./install.sh
  • 下載安裝 zsh-autosuggestions (自動補全可能路徑)
    • git clone git://http://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
  • 下載 autojump (快速跳轉)
    • git clone https://github.com/joelthelion/autojump.git
    • cd autojump
    • ./install.py
    • 將[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh添加到zshrc文件尾 下載安裝 zsh-syntax-highlighting (終端輸入高亮 正確路徑下劃線)
    • git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  • vi ~/.zshrc
  • plugins=(git autojump zsh-autosuggestions zsh-syntax-highlighting)
  • source .zshrc
  • 改變默認shell
    • chsh -s /bin/zsh

輔助命令查看libc版本

  • find / -name libc.so.6
  • ll /lib/x86_64-linux-gnu/libc.so.6 lrwxrwxrwx 1 root root 12 4月 15 06:11 /lib/x86_64-linux-gnu/libc.so.6 -> libc-2.23.so
  • sudo ldd --version

ldd (Ubuntu GLIBC 2.27-3ubuntu1) 2.27 Copyright (C) 2018 自由軟件基金會。開啟ssh

  • apt-get install openssh-server
  • vi /etc/ssh/sshd_config
  • vi /etc/ssh/ssh_config

添加:PermitRootLogin yes
以上就是本期全部內容啦!!【下期預告】二進制安全之堆溢出——堆基礎 & 結構

總結

以上是生活随笔為你收集整理的c++算术溢出_二进制安全之堆溢出(系列)——CTF环境配置的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。