DNS协议隧道

防火墙禁止TCP出站访问流量

- SSH隧道、端口准发全部失效

- 使用基于UPD协议的隧道

- DNS的工作原理适合用于实现隧道

DNS工作原理

- DNS隧道原理: 注册受自己控制的DNS记录

DNS协议隧道-----dns2tcp

Dns2tcp

- 利用合法DNS服务器实现DNS隧道

- C/S(dns3tcpc / dns2tcpd)结构

- 通过TXT记录加密传输数据(A记录长度有限)

- 隧道建立后保持连接

- 默认记录生存时间TTL值为3秒

安装

- apt-get install dns2tcp

- Kali默认安装

**** This is mOnOwall, version 1.8.1

built on Web Jan 15 13:32:38 GET 2014 for generic-pc

Copyright (C) 2002-2014 by Manuel Kasper. All rights reserved.

Visit http://mOnO.ch/wall for updates.

LAN IP address: 192.168.1.1

WAN IP address: (unknown)

Port configuration:

LAN    -> em0

WLAn   -> em1

mOnOwall console setup

*********************

1) Interfaces: assign network ports

2) Set up LAN IP address

3) Reset webGUI password

4) Reset to factory defaults

5) Reboot system

6) Ping host

7) Install on Hard Drive

Enter a number:

yuanfh@Bodhi:~$ ifconfig

1.1.1.10

yuanfh@Bodhi:~$ netstat -nr

Kernel IP routing table

Destination      Gateway      Genmask          Flags      MSS Windows    irtt Iface

0.0.0.0          1.1.1.1      0.0.0.0          UG           0 0             0 eth0

1.1.1.0          0.0.0.0      255.255.255.0    U            0 0             0 eth0

monowall IP: 192.168.1.123

yuanfh@Bodhi:~$ sudo apt-get install dns2tcp wireshark firefox

DNS协议隧道-----dns2tcp

演示环境-1

- Win 2003: 安装DNS服务;配置转发器;创建区域lab.com;指派二级域

test.lab.com,NS记录指向Kali

- 防火墙:只允许出站UDP 53端口流量

- Bodhi Linux:

安装dns2tcp、wireshark、firebox

dns2tcpc -c -k pass -d 1 -l 2222 -r ssh -z test.lab.com

安装DNS

开始运行“appwiz.cpl”----->添加/删除windows组件----->网络服务----->域名系统----->确定----->下一步

DNS----->正向查找区域----->主要区域----->lab.com----->创建新文件,文件名为(C):lab.com.dns----->不允许动态更新----->完成

新建主机记录----->kali----->192.168.1.110----->添加主机----->完成

lab.com----->右键"新建委派"----->受委派域名,test----->名称服务器,添加“kali”----->完成

配置转发器

服务器图标“W2K3”----->属性----->转发器----->所选与的转发器的IP地址列表:127.207.160.106,添加。219.239.26.42,添加----->应用,确定

yuanfh@Bodhi:~$ cat /etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

nameserver 172.0.0.1

search local

yuanfh@Bodhi:~$ sudo vi /etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

nameserver 192.168.1.124

search local

yuanfh@Bodhi:~$ nslookup

>set q=ns

>lab.com

Server:          192.168.1.124

Address:         192.168.1.124#53

lab.com nameserver = w2k3

>set q=ns

>test.lab.com

Server:          192.168.1.124

Address:         192.168.1.124#53

Non-authoritative answer:

test.lab.com     nameserver = kali.lab.com.

Authoritative answer can be found from:

kali.lab.com    internet address = 192.168.1.110

> set q=a

> kali.lab.com

Server:          192.168.1.124

Address:         192.168.1.124#53

Name:    kali.lab.com

Address:192.168.1.110

> www.baidu.com

Server:          192.168.1.124

Address:         192.168.1.124#53

Non-authoritative answer:

www.baidu.com   canonical name = www.a.shifen.com.

Name:   www.a.shifen.com

Address: 119.75.218.70

Name:   www.a.shifen.com

Address: 119.75.217.109

>www.taobao.com

Server:          192.168.1.124

Address:         192.168.1.124#53

Non-authoritative answer:

www.taobao.com   canonical name = www.taobao.com.danuoyi.thcache.com.

Name:   www.taobao.com.danuoyi.thcache.com.

Address: 124.193.235.253

Name:   www.taobao.com.danuoyi.thcache.com.

Address: 124.193.235.253

DNS协议隧道-----dns2tcp

服务器配置文件

- /etc/dns2tcpd.conf

- .dns2tcprcd

- 资源可以是其他地址

启动

- dns2tcpd -F -d 1 -f /etc/dns2tcpd.conf

- F:前端运行

- d:debug level 1-3

- f:指定配置文件

listen = 0.0.0.0

port = 53

user = nobody

chroot = /tmp

key = password123

domain = test.lab.com

resources = ssh:127.0.0.1:22 , smtp:127.0.0.1:25 , socks:127.0.0.1:1082,

https:127.0.0.1:8087 , http:127.0.0.1:3128

-------------------------------------------------------------------------

root@K:~# vi /etc/dns2tcpd.conf

listen = 0.0.0.0

port = 53

user = nobody

chroot = /tmp

domain = test.lab.com

resources = ssh:127.0.0.1:22 , smtp:127.0.0.1:25 , socks:127.0.0.1:1082,

http:127.0.0.1:3128 , https:127.0.0.1:8087

root@K:~# vi /etc/ssh/sshd_config

PermitRootlogin yes

PasswordAuthentication yes

root@K:~# service ssh start

root@K:~# dns2tcpd -F -d 1 -f /etc/dns2tcpd/conf

19:22:22 : Debug options.c:97 Add resource ssh:127.0.0.1 port 22

19:22:22 : Debug options.c:97 Add resource smtp:127.0.0.1 port 25

19:22:22 : Debug options.c:97 Add resource socks:127.0.0.1 port 1080

19:22:22 : Debug options.c:97 Add resource http:127.0.0.1 port 3128

19:22:22 : Debug options.c:97 Add resource https:127.0.0.1 port 8087

19:22:22 : Debug options.c:55 Listening on 0.0.0.0:53 for domain test.lab.com

Starting Server v0.5.2...

19:22:22 : Debug mian.c:132   Chroot to /tmp

19:22:24 : Debug main.c:142   Change to user nobody

root@K:~# service ssh start

root@K:~# vi /etc/sshd_config

listen = 0.0.0.0

port = 53

user = nobody

chroot = /tmp

domain = test.lab.com

key = pass123

resources = ssh:127.0.0.1:22 , smtp:127.0.0.1:25 , socks:127.0.0.1:1082,

http:192.168.1.1:80 , https:127.0.0.1:8087

root@K:~# dns2tcpd -F -d 1 -f /etc/dns2tcpd/conf

19:22:42 : Debug options.c:97 Add resource ssh:127.0.0.1 port 22

19:22:42 : Debug options.c:97 Add resource smtp:127.0.0.1 port 25

19:22:42 : Debug options.c:97 Add resource socks:127.0.0.1 port 1080

19:22:42 : Debug options.c:97 Add resource http:192.168.1.1 port 3128

19:22:42 : Debug options.c:97 Add resource https:127.0.0.1 port 8087

19:22:242 : Debug options.c:55 Listening on 0.0.0.0:53 for domain test.lab.com

Starting Server v0.5.2...

19:22:42 : Debug mian.c:132   Chroot to /tmp

19:22:42 : Debug main.c:142   Change to user nobody

yuanfh@Bodhi:~$ dns2tcpc -c -k pass123 -d 1 -l 2222 -r ssh -z test.lab.com

No DNS given, using 192.168.1.124 (first entry found in resolv.conf)

debug level 1

Listening on port : 2222

No response from DNS 192.168.1.124

19:46:26 : Debug session.c:54   Session created (0xd97d)

19:46:26 : Debug auth.c:94      Connect to resource "ssh"

19:46:26 : Debug client.c:141   Adding client auth OK:0xd97d

19:46:26 : Debug requests.c:274 send desauth

19:46:26 : Debug client.c:69    free client

^C

yuanfh@Bodhi:~$ sudo wireshark

[sudo] password for yuanfh:

(!(ipv6.version == 6)&&!(ip.src == 192.168.56.1)

yuanfh@Bodhi:~$ ssh root@127.0.0.1 -p 2222

The authenticity of host '[127.0.0.1]:2222 ([127.0.0.1]:2222)' can't be established.

ECDSA key fingerprint is 6f:bf:fc:e5:d0:96:65:34:99:7d:81:06:b6:5e:44:50.

Are you sure want to continue connectione (yes\no)? yes

Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.

root@127.0.0.1's password:

The programs included with the Kali GHU/Linux system are free softwere:

the exact distribution terms for each program are described in the indicidual files in  /usr/share/doc/*/copyright.

Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY. to the extent

permitted by applicable law.

yuanfh@Bodhi:~$ dns2tcpc -c -k pass123 -d 1 -l 2222 -r http -z test.lab.com

No DNS given, using 192.168.1.124 (first entry found in resolv.conf)

debug level 1

Listening on port : 2222

yuanfh@Bodhi:~$ dns2tcpc -c -k pass123 -d 1 -l 7001 -r https -z test.lab.com

No DNS given, using 192.168.1.124 (first entry found in resolv.conf)

debug level 1

Listening on port : 7001

root@K:~# whois 107.178.195.142

root@K:~# apt-get install squid

squid         squidclient     squid-deb-proxy           squidguard-doc    squidtaild

squid3        squid-common    squid-deb-proxy-client    squid-langpack    squidview

squid-cql     squid-dbg       squidguard                squid-purge

root@K:~# apt-get install squid3

DNS协议隧道-----dns2tcp

资源访问

- 本地SSH资源

- 远程http资源

- http资源(squid)

apt-get install squid3

- http代理

- 隧道嵌套

基于SSH资源将SSH动态端口转发隧道嵌套与DNS隧道中

ssh -CFNg root@127.0.0.1 -p 2222 -D 7001

XP IE、Firefox使用嵌套的Socks代理上网

抓包分析DNS隧道通信

yuanfh@Bodhi:~$ netstat -pantu | grep 7001

(Not all processes could be identified, non-owned process info

will not be shown, you would have to be root to see it all.)

tcp        0      0 127.0.0.1:7001          0.0.0.0:*              LISTEN     2588/dns2tcpc

tcp        0      0 127.0.0.1:7001          127.0.0.1:55888        CLOSE_WAIT 2588/dns2tcpc

tcp        0      0 127.0.0.1:7001          127.0.0.1:55716        CLOSE_WAIT 2588/dns2tcpc

tcp        0      0 127.0.0.1:7001          127.0.0.1:55724        CLOSE_WAIT 2588/dns2tcpc

tcp        0      0 127.0.0.1:55714         127.0.0.1:7001         TIME_WAIT  -

tcp        0      0 127.0.0.1:7001          127.0.0.1:55768        CLOSE_WAIT 2588/dns2tcpc

tcp        0      0 127.0.0.1:7001          127.0.0.1:55766        CLOSE_WAIT 2588/dns2tcpc

tcp        0      0 127.0.0.1:7001          127.0.0.1:55718        CLOSE_WAIT 2588/dns2tcpc

tcp        0      0 127.0.0.1:7001          127.0.0.1:55720        CLOSE_WAIT 2588/dns2tcpc

tcp        0      0 127.0.0.1:7001          127.0.0.1:55712        CLOSE_WAIT 2588/dns2tcpc

tcp        0      0 127.0.0.1:7001          127.0.0.1:55722        CLOSE_WAIT 2588/dns2tcpc

tcp        0      0 127.0.0.1:55730         127.0.0.1:7001         TIME_WAIT  -

tcp        0      0 127.0.0.1:55888         127.0.0.1:7001         FIN_WAIT2  -

tcp        0      0 127.0.0.1:7001          127.0.0.1:55770        CLOSE_WAIT 2588/dns2tcpc

tcp        0      0 127.0.0.1:7001          127.0.0.1:55736        CLOSE_WAIT 2588/dns2tcpc

yuanfh@Bodhi:~$ dns2tcpc -k pass123 -d 1 -l 2222 -r ssh -z test.lab.com

No DNS given, using 192.168.1.124 (first entry found in resolv.conf)

debug level 1

Listening on port : 2222

yuanfh@Bodhi:~$ ssh -CFNg root@127.0.0.1 -p 2222 -D 7002

root@127.0.0.1 password:

yuanfh@Bodhi:~$ netstat -pantu | grep 7002

(Not all processes could be indentified, non-owned process info

will not be shown, you would have to be root to se it all.)

tcp        0      0 127.0.0.1:7002        0.0.0.0:*           LISTEN      2692/sshd

tcp6       0      0 ::1:7002              :::*                LISTEN      2692/sshd

该笔记为安全牛课堂学员笔记,想看此课程或者信息安全类干货可以移步到安全牛课堂

Security+认证为什么是互联网+时代最火爆的认证?

牛妹先给大家介绍一下Security+

Security+ 认证是一种中立第三方认证,其发证机构为美国计算机行业协会CompTIA ;是和CISSP、ITIL 等共同包含在内的国际 IT 业 10 大热门认证之一,和CISSP偏重信息安全管理相比,Security+ 认证更偏重信息安全技术和操作。

通过该认证证明了您具备网络安全,合规性和操作安全,威胁和漏洞,应用程序、数据和主机安全,访问控制和身份管理以及加密技术等方面的能力。因其考试难度不易,含金量较高,目前已被全球企业和安全专业人士所普遍采纳。

Security+认证如此火爆的原因?

原因一:在所有信息安全认证当中,偏重信息安全技术的认证是空白的, Security+认证正好可以弥补信息安全技术领域的空白 。

目前行业内受认可的信息安全认证主要有CISP和CISSP,但是无论CISP还是CISSP都是偏重信息安全管理的,技术知识讲的宽泛且浅显,考试都是一带而过。而且CISSP要求持证人员的信息安全工作经验都要5年以上,CISP也要求大专学历4年以上工作经验,这些要求无疑把有能力且上进的年轻人的持证之路堵住。在现实社会中,无论是找工作还是升职加薪,或是投标时候报人员,认证都是必不可少的,这给年轻人带来了很多不公平。而Security+的出现可以扫清这些年轻人职业发展中的障碍,由于Security+偏重信息安全技术,所以对工作经验没有特别的要求。只要你有IT相关背景,追求进步就可以学习和考试。

原因二: IT运维人员工作与翻身的利器。

在银行、证券、保险、信息通讯等行业,IT运维人员非常多,IT运维涉及的工作面也非常广。是一个集网络、系统、安全、应用架构、存储为一体的综合性技术岗。虽然没有程序猿们“生当做光棍,死亦写代码”的悲壮,但也有着“锄禾日当午,不如运维苦“的感慨。天天对着电脑和机器,时间长了难免有对于职业发展的迷茫和困惑。Security+国际认证的出现可以让有追求的IT运维人员学习网络安全知识,掌握网络安全实践。职业发展朝着网络安全的方向发展,解决国内信息安全人才的匮乏问题。另外,即使不转型,要做好运维工作,学习安全知识取得安全认证也是必不可少的。

原因三:接地气、国际范儿、考试方便、费用适中!

CompTIA作为全球ICT领域最具影响力的全球领先机构,在信息安全人才认证方面是专业、公平、公正的。Security+认证偏重操作且和一线工程师的日常工作息息相关。适合银行、证券、保险、互联网公司等IT相关人员学习。作为国际认证在全球147个国家受到广泛的认可。

在目前的信息安全大潮之下,人才是信息安全发展的关键。而目前国内的信息安全人才是非常匮乏的,相信Security+认证一定会成为最火爆的信息安全认证。

【安全牛学习笔记】DNS协议隧道、DNS协议隧道-dns2tcp相关推荐

  1. TCP / IP学习笔记(9)-dns域名系统

    TCP / IP学习笔记(9)-dns域名系统 前面已经提到了访问一台机器要靠IP地址和MAC地址,其中,MAC地址可以通过ARP协议得到,所以这对用户是透明的,但是IP地址就不行,无论如何用户都需要 ...

  2. STM32学习笔记(15)——SPI协议

    STM32学习笔记(15)--SPI协议 一.SPI协议简介 1. 物理层 2. 协议层 (1) 通讯的开始与停止 (2)时钟极性CPOL.时钟相位CPHA 二.STM32的SPI外设 1. 通讯引脚 ...

  3. nrf52832 学习笔记(七)蓝牙协议层级理解

    nrf52832 学习笔记(七)蓝牙协议层级理解 本文主要由一下几篇文档摘录汇总而成 ,如有错误欢迎斧正 da14531 蓝牙协议文档 深入浅出低功耗蓝牙(BLE)协议栈 低功耗蓝牙ATT/GATT/ ...

  4. 【计算机网络学习笔记09】ARP地址解析协议

    [计算机网络学习笔记09]ARP地址解析协议 ARP地址解析协议 在实际应用中,我们常会遇见这样的问题:已知一个机器(主机或路由器)的IP地址,需要找出其相应的硬件,这时就需要使用到地址地址解析协议( ...

  5. USB学习笔记(2)USB协议

    USB学习笔记(2)USB协议 本文对前面提到的USB枚举过程中的标准请求以及各种描述符做出大致解释,方便后面的实操. 1. USB标准请求 USB协议定义了一个8字节的标准设备请求,主要用在设备的枚 ...

  6. 【安全牛学习笔记】DNS放大攻击

    DNS放大攻击 产生大流量的攻击方法 - 单机的宽带的优势 - 巨大单机数量形成的流量汇聚 - 利用协议特性实现放大效果的流量 DNS协议放大效果 - 查询请求流量小,但响应流量可能非常巨大 - di ...

  7. 【安全牛学习笔记】DNS信息收集

    dig sina.com any @8.8.8.8 dig 163.com any dig +noall(什么都不显示) +answer mail.162.com any|awk'{print $5} ...

  8. 后台系统可扩展性学习笔记(三)DNS机制原理

    文章目录 DNS概念梳理 域名基本概念 资源记录基本概念 路由策略 DNS 域空间结构 实现原理 复制机制 查询机制 缓存机制 参考 DNS概念梳理 DNS(Domain Name System)相当 ...

  9. 【安全牛学习笔记】CCNA简介

    课程介绍 1.CCNA CCNP CCIE 2.目标: (1)掌握小型网络的安装.操作及排障所需的知识及技能 (2)安装.造作及排障中型规模网络 (3)WAN技术 3.课程安排 4.思科图标和符号 5 ...

最新文章

  1. Python全栈Day 15部分知识点
  2. Cassandra安装测试
  3. Azure恢复服务-使用Windows Backup恢复文件
  4. 《MySQL——redo log 与 binlog 写入机制》
  5. 为什么只能sudo进mysql_解决项目中MySQL数据库执行删除语句时间太长的问题
  6. Python Flask Web 第八课 —— request 请求对象
  7. matlab赌徒破产模型转移矩阵,基于matlab的土地利用转移矩阵及土地利用转移空间分布...
  8. windows利用diskpart格式化磁盘
  9. 蓝桥杯:座次问题(枚举法 回溯) java
  10. 个性化精简掉了Win10便签顶部如何恢复
  11. PIX for Windows使用
  12. 使用数字陷波器滤除工频信号
  13. 复旦发布报告!70后度过中年危机?80后珍惜家庭?90后高压期来临?
  14. 前端工程师的摸鱼日常(11)
  15. 微信如何赚钱?Kakao和Line营收模式或应借鉴
  16. 服务器禁用账号登录,服务器如何防止被爆破账号密码
  17. 华三服务器管理口地址_h3c 的交换机怎样设置管理地址?
  18. 迪杰斯特拉-最短路径算法
  19. 酒店管理系统(Java实现)
  20. 金九银十:Redis难题突破,最经典36题含详细解析

热门文章

  1. 深度学习在医学影像的创新
  2. 计算机指令系统基础 - 流水线详解
  3. 攻防世界 XCTF 进阶区 解题报告
  4. JavaScript基础: ES6新特性---Symbol
  5. python 文件解压缩
  6. 360集团Java开发工程师校招面经
  7. 5.8 2021年5月9日,是第108个母亲节
  8. 深度linux 仿宋体,解决黑体、宋体、仿宋等字体的缺失:如何从win10复制字体?...
  9. Django学习之旅(六)自定义URL规则(博客详情页)
  10. 星际蜗牛安装Centos 7系统做家用服务器