一步一步pwn路由器之环境搭建
前言
本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274
正式进入路由器的世界了。感觉路由器这块就是固件提取,运行环境修复比较麻烦,其他部分和一般的 pwn 差不多。由于大多数路由器是 mips 架构的,本文就以搭建 MIPS运行、调试平台 为例介绍环境的搭建。其他架构类似。
正文
安装 与 配置 Qemu:
apt-get install qemu
apt-get install qemu-user-static
apt-get install qemu-system
apt-get install uml-utilities
apt-get install bridge-utils
配置网络
方法一(推荐)
创建网桥,名字是 virbr0
sudo brctl addbr virbr0
sudo ifconfig virbr0 192.168.122.1/24 up
创建 tap 接口,名字为 tap0,并添加到网桥
sudo tunctl -t tap0
sudo ifconfig tap0 192.168.122.11/24 up
sudo brctl addif virbr0 tap0
然后运行
sudo qemu-system-mips -M malta -kernel mips_vmlinux-3.2.0-4-4kc-malta -hda debian_wheezy_mips_standard.qcow2 -append "root=/dev/sda1 console=tty0" -netdev tap,id=tapnet,ifname=tap0,script=no -device rtl8139,netdev=tapnet -nographic
然后在 虚拟机里面设置 ip
sudo ifconfig eth0 192.168.122.12/24 up
来源
https://blog.csdn.net/RichardYSteven/article/details/54807927
方法二
修改 /etc/network/interfaces :
auto lo
iface lo inet loopback
# ubuntu 16.04的系统用ens33代替eth0
auto eth0
iface eth0 inet manual
up ifconfig eth0 0.0.0.0 up
auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_stp off
bridge_maxwait 1
修改 /etc/qemu-ifup :
#!/bin/sh
echo "Executing /etc/qemu-ifup"
echo "Bringing $1 for bridged mode..."
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
echo "Adding $1 to br0..."
sudo /sbin/brctl addif br0 $1
sleep 3
增加权限 chmod a+x /etc/qemu-ifup.
重启网络服务
/etc/init.d/networking restart
下载与运行qemu的镜像
uclibc交叉编译工具链 和 qemu系统镜像
https://www.uclibc.org/downloads/binaries/0.9.30.1/

运行示例(解压,运行即可)
sudo qemu-system-mips -M malta -nographic -no-reboot -kernel "zImage-mips" -hda "image-mips.ext2" -append "root=/dev/hda rw init=/usr/sbin/init.sh panic=1 PATH=/usr/bin console=ttyS0" -net nic -net tap -drive file=/tmp/share.img

openwrt预先编译好的内核,mips小端
https://downloads.openwrt.org/snapshots/trunk/malta/generic/

运行
sudo qemu-system-mipsel -kernel openwrt-malta-le-vmlinux-initramfs.elf -M malta -drive file=/tmp/share.img -net nic -net tap -nographic
debian mips qemu镜像
https://people.debian.org/~aurel32/qemu/mips/

sudo qemu-system-mips -M malta -kernel vmlinux-2.6.32-5-4kc-malta -hda debian_squeeze_mips_standard.qcow2 -append "root=/dev/sda1 console=tty0" -net nic -net tap -nographic
时间比较长

安装pwndbg
一个类似于 peda的gdb插件,支持多种架构,pwn最强gdb插件。用了它之后发现ida的调试简直渣渣。一张图说明一切。

安装的话按照github上的说明即可。
https://github.com/pwndbg/pwndbg
要用来调试MIPS的话,要安装
sudo apt install gdb-multiarch
然后按照正常的gdb使用就行。

安装firmadyne
一个路由器运行环境,傻瓜化操作,但是无法调试......
https://github.com/firmadyne/firmadyne
安装mipsrop插件
貌似其他的rop工具都不能检测处mips的 gadgets,这个不错。
https://github.com/devttys0/ida/tree/master/plugins/mipsrop
扔到ida的plug目录即可

安装 PleaseROP 插件
jeb 2.3+ 的适用于arm , mips通用 rop gadgets搜索插件
下载后放到jeb根目录的 coreplugins 目录下,重新打开Jeb即可。

找到的结果可以在下面位置找到

binwalk完整安装
一定要安装完整的版本不然有些固件解不了。
http://blog.csdn.net/qq1084283172/article/details/65441110
gdbserver
各种平台的静态编译版本
https://github.com/mzpqnxow/embedded-toolkit
总结
很简单,就这样
参考链接:
http://blog.csdn.net/qq1084283172/article/details/70176583
注:
本文先发布于:https://xianzhi.aliyun.com/forum/topic/1508/
一步一步pwn路由器之环境搭建的更多相关文章
- 一步一步pwn路由器之rop技术实战
前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 这次程序也是 DVRF 里面的,他的路径是 pwnable/She ...
- 一步一步pwn路由器之wr940栈溢出漏洞分析与利用
前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 这个是最近爆出来的漏洞,漏洞编号:CVE-2017-13772 固 ...
- 一步一步pwn路由器之路由器环境修复&&rop技术分析
前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 拿到路由器的固件后,第一时间肯定是去运行目标程序,一般是web服务 ...
- 一步一步pwn路由器之uClibc中malloc&&free分析
前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 栈溢出告一段落.本文介绍下 uClibc 中的 malloc 和 ...
- 一步一步pwn路由器之radare2使用实战
前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 前文讲了一些 radare2 的特性相关的操作方法.本文以一个 c ...
- 一步一步pwn路由器之radare2使用全解
前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 radare2 最近越来越流行,已经进入 github 前 25了 ...
- 一步一步pwn路由器之栈溢出实战
前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 本文以 DVRF 中的第一个漏洞程序 stack_bof_01 为 ...
- 十步轻松搞定IIS+PHP环境搭建
突然心血来潮想着自己一直使用Apache+php的模式,想要了解一下IIS+php的模式.说起来也算是九曲十八弯吧! 第一部分:以ISAPI.dll 扩展的形式 结果按照资料上面说的我就是找不到一个i ...
- pwn的一些环境搭建
<1>pwntools库安装 pwntools是一个CTF框架和漏洞利用开发库,用Python开发,由rapid设计,旨在让使用者简单快速的编写exploit. 本文将基于KUbuntu ...
随机推荐
- java 字符串(String)常用技巧及自建方法模块汇总
1.String类常用方法汇总 (1)删除字符串的头尾空白符 public String trim() (2)从指定位置截取字符串 public String substring(int beginI ...
- P2486 [SDOI2011]染色(树剖)区间覆盖+区间的连续段
https://www.luogu.org/problemnew/show/P2486 值的一看https://www.cnblogs.com/Tony-Double-Sky/p/9283262.ht ...
- 2019.04.18 第六次训练 【2018-2019 ACM-ICPC, NEERC, Southern Subregional Contest, Qualification Stage】
题目链接: https://codeforces.com/gym/101911 又补了set的一个知识点,erase(it)之后it这个地址就不存在了,再引用的话就会RE A: ✅ B: ✅ C: ...
- Html5与本地App资料整理分析
最近开发了一个小的手机网站,重新了解了本地应用,html5,混合应用,webApp等概念,整理下相关的资料,略带自己的思考 用户固有的使用习惯 在<2012年度 HTML5状况及发展形势报告.p ...
- 【树】Validate Binary Search Tree
需要注意的是,左子树的所有节点都要比根节点小,而非只是其左孩子比其小,右子树同样.这是很容易出错的一点是,很多人往往只考虑了每个根节点比其左孩子大比其右孩子小.如下面非二分查找树,如果只比较节点和其左 ...
- Linux 下使用yum 命令安装MySQL
Linux下使用yum安装MySQL,以及启动.登录和远程访问MySQL数据库. 1.yum安装mysql 1. 查看有没有安装包: yum list mysql* #移除已经安装的mysq ...
- python-wsgi测试服务器
#!/usr/bin/python from wsgiref.simple_server import make_server def application(environ,start_respon ...
- linux mint 19安装 kvm 软件包
1 我的处理器是2700x 首先安装cpu检测 sudo apt-get install cpu-checker 2 查看cpu内核 egrep -c '(vmx|svm)' /proc/cpuinf ...
- Integer源码分析
Integer中包含了大量的static方法. 1.分析Integer的缓存机制:首先定义了一个缓存区,IntegerCache,其实就是一个Integer数组cache[],它默认存储了从-128~ ...
- idp sp sso---SAML Single Sign-On (SSO) Service for Google Apps
src: https://developers.google.com/google-apps/sso/saml_reference_implementation Security Assertion ...