前言


本文由 本人 首发于 先知安全技术社区: 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搜索插件

PleaseROP

下载后放到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路由器之环境搭建的更多相关文章

  1. 一步一步pwn路由器之rop技术实战

    前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 这次程序也是 DVRF 里面的,他的路径是 pwnable/She ...

  2. 一步一步pwn路由器之wr940栈溢出漏洞分析与利用

    前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 这个是最近爆出来的漏洞,漏洞编号:CVE-2017-13772 固 ...

  3. 一步一步pwn路由器之路由器环境修复&&rop技术分析

    前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 拿到路由器的固件后,第一时间肯定是去运行目标程序,一般是web服务 ...

  4. 一步一步pwn路由器之uClibc中malloc&&free分析

    前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 栈溢出告一段落.本文介绍下 uClibc 中的 malloc 和 ...

  5. 一步一步pwn路由器之radare2使用实战

    前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 前文讲了一些 radare2 的特性相关的操作方法.本文以一个 c ...

  6. 一步一步pwn路由器之radare2使用全解

    前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 radare2 最近越来越流行,已经进入 github 前 25了 ...

  7. 一步一步pwn路由器之栈溢出实战

    前言 本文由 本人 首发于 先知安全技术社区: https://xianzhi.aliyun.com/forum/user/5274 本文以 DVRF 中的第一个漏洞程序 stack_bof_01 为 ...

  8. 十步轻松搞定IIS+PHP环境搭建

    突然心血来潮想着自己一直使用Apache+php的模式,想要了解一下IIS+php的模式.说起来也算是九曲十八弯吧! 第一部分:以ISAPI.dll 扩展的形式 结果按照资料上面说的我就是找不到一个i ...

  9. pwn的一些环境搭建

    <1>pwntools库安装 pwntools是一个CTF框架和漏洞利用开发库,用Python开发,由rapid设计,旨在让使用者简单快速的编写exploit. 本文将基于KUbuntu ...

随机推荐

  1. windows server 2012 valid key

    好吧,网页三剑客. 1, load disc iso 2,check ip settings, 3,net-inst-server-start 4,power Node, F2 4.1 F7 usbc ...

  2. 完美解决linux系统sublime不能输入中文

    1.下载git项目:sublime-text-imfix,主要是要用到里面的两个文件   subl和libsublime-imfix.so git项目路径:https://github.com/lyf ...

  3. auguements实参对象的数组化

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. java调用svnkit工具类上传本地文件到svn服务器

    package org.jenkinsci.plugins.svn.upload.step; import java.io.*; import org.tmatesoft.svn.core.SVNCo ...

  5. redis 实现消息发布和订阅

    1,打开二个客户端机器 一个用于发布,一个用于接受 2,发布一个channel1 3,用另外一个客户端收听上面的客户端 4,当再次在发布的redis客户端 发布一个消息  其他所有订阅的客户端会自动收 ...

  6. 用jquery来实现类似“网易新闻”横向标题滑动的移动端页面

    HTML: <div id="navbar"> <div id='navbar_content' style="left:0px;"> ...

  7. java多线程---------java.util.concurrent并发包----------等待多线程完成

    一.等待多线程完成的join的使用.CoundownLantch.CyclicBarrier .

  8. a+b+c的N次方展开

    今天在给儿子看笔记本上的照片的时候,偶然发现了2009年手绘的一张a+b+c的N次方展开图,故写下面的博客以记之,为年轻时代的我点个赞! 20年前的我,一个充满激情的且富有专注力的数学发烧友! 10年 ...

  9. 【angular5项目积累总结】消息订阅服务

    code import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; @Injectable ...

  10. HTML5--(1)兼容前缀+结构性标签+语义化标签

    一.兼容前缀+兼容写法 兼容前缀 1.HTML5有部分类容兼容到IE9,IE8及以下完全不兼容的内容不再考虑. 2.部分内容需要加兼容前缀 a)     -webkit- 兼容谷歌 b)     -m ...