【文档说明】Web应用的安全模式.pptx,共(55)页,267.124 KB,由精品优选上传
转载请保留链接:https://www.ichengzhen.cn/view-288982.html
以下为本文档部分文字说明:
Web应用的“外患”与“内忧”谭晓阳Txy@graphics.nju.edu.cnBasedon《SecuritymodelsforWeb-basedapplication》byJamesB.D.Josh
i,WalidG.Aref,ArifGhafoorFebruary2001/Vol.44.No.2p38-44《CommunicationofACM》本讲内容介绍基本的安全概念和基本的安全机制Web环境下的安全
机制防火墙的工作原理常用的安全措施Web应用安全“外患”“内忧”“外患”•AspectsofSecurity•AuthenticationandEncryption•InternetFirewallsandPacketFiltering•VirtualPriv
ateNetworks•SecureHTTP(SHTTP)andSecureSocketLayer(SSL)•SecuringyourSiteMainrisks:信息被非法窃听:未经认可的用户对数据的非法访问假冒他人发送信息信息被非法修改拒绝服务
病毒。。。解决DataIntegrity:referstoprotectionfromchange:Isthedatareceivedexactlythesameasthedatathatwassent?DataAvailability:referstoprotectionaga
instdisruptionofservice:Doesthedataremainavailableforlegitimateuse?DataConfidentiality:referstoprotectionaga
instunauthorizeddataaccess:Isdataprotectedagainstunauthorizedaccess?Privacy:referstotheabilityofthesendert
oremainanonymous:Isthesender’sidentityrevealed?完整性机制防止偶然或故意破坏数据完整性的常用方法:◼奇偶校验(paritybits)◼校验和(checksum)◼循环冗余校验(cyclicredundanc
ychecks,CRC).发送者以包的数据为函数计算出一个整数值。接收者从接收到的数据中重新计算出这个整数,并比较二者的结果。However,aattackercancreateavalidchecksumorCRCfr
omthealtereddata.完整性机制Severalmechanismsagainstmalicious(恶意)intentionalchangeofintercepteddataexist:用MAC(Mess
ageAuthenticationCode)来编码要发送的数据。◼MAC基于无法破译或仿造的密码机制工作。◼采用只有收发双方知道的secretkey。◼发送者用thesecretkey来scramblethedataandthec
hecksumorCRC访问控制和口令在传统的计算机系统中,简单的口令即足以保护对系统的访问。Simplepasswordmechanismsarevulnerable(易受攻击)onnetworksbecausetheyaresusceptibletoeavesdropping(偷听).Wir
etapping(搭线窃听)iseasyespeciallythatpasswordsontelnet,FTPorHTTParecleartext.“外患”•AspectsofSecurity•AuthenticationandEncryption•InternetFirewallsan
dPacketFiltering•VirtualPrivateNetworks•SecureHTTP(SHTTP)andSecureSocketLayer(SSL)•SecuringyourSite你是谁?Howdoyouknowthecu
stomeristhecustomerhe/shepretendstobe?Howdoyouknowtheserveristheserveritpurportstobe?IsitreallythethewebpageIwan
ttoconnectto?IsitreallythecompanyIwanttomakeatransactionwith?IsitreallythecustomerIthinkIamdealingwith?认证Theprocessofmakingsuretheser
verandtheclientareindeedtheserverandclienttheypurporttobeiscalledauthentication.用户认证是计算机安全中最为困难的部分之一。Authenticationisbasedondigitalsi
gnaturesTosignamessage,thesenderencryptsthemessageusingakeyknownonlytothesender加密目的:即使消息被窃听(wiretapping)也仍可保持其confidentiality.方法:SenderScramblesthe
bitsofthemessageinawaythatonlytheintendedreceivercanunscramblethemessage.Basedonkeys.结果:Interceptingamessagesisuselesssincenoin
formationextraction.对等加密ThereceiverandthesendersharethesamesecretkeyThesenderencryptsthemessagewithakeyKandthere
ceiverdecodestheencryptedmessagewiththesamekeyK.Example:DESE=encrypt(Key,M)M=decrypt(Key,E)Mathematicallydecryptisinver
seofencryptdecrypt=encrypt-1对称加密缺陷◼需要进行私钥交换◼规模复杂◼未知实体间通信困难公钥密码机制由Deffie和Hellman发明:◼“NewDirectionsinCryptography”
,1976原理◼Publiclyrevealinganencryptionkeydoesnottherebyrevealthecorrespongdingdecryptiondecryption.重要结论Noneedtotransmitkeys.◼onlytheintended
recipientcandecipherthemessage.Amessagecanbe“signed”byaprivatelyhelddecryptionkey.◼Signaturescannotbeforged.◼Asignercannotlaterdenythevalidaityof
hissignature.下面我们来看如何用这种机制来实现:◼机密性和隐私性:privacyandconfidentiality◼数字签名:signature◼实体鉴别:authenticationPrivacyandconfidencialityBob向
Alice发一个privatemessage的过程:◼GetthepublickeyEafromthepublicfile◼SendherEa(M)◼Alicedecpherit:Da(Ea(M))=M特点◼Noneedtoestablishprivatetransactio
ns(保证了私密性)◼Anintruderlisteninginonthechannelcannotdecipheranymessages.Sincederivedecryptionkeysfromencryptionkeysisimpossibl
e.(保证了机密性)数字签名SignaturesAlice首先用自己的私钥对要发给Bob的消息签名:s=Da(M)然后用Bob的公钥加密:Eb(S).并把结果发出.Bob先用自己的私钥解密得到S,然后用Alice的公钥解密得到M.数字签名Signatures完整性:B
ob或其他人不可修改M,对输入数据的任何修改都会引起输出的变化。不可否认性:Alice不可否认发给Bob消息,因为除了他没人能得到他的签名s=Da(M)。机密性:因为只有Bob才有他自己的私钥,别人无法获得。Authentication简单的<id,password>的缺陷:◼Repl
ay:重放攻击◼例子:“阿里巴巴与四十大盗”基于公钥技术,采用“挑战-响应”协议和信息签名解决实体鉴别问题.◼AlicechallengetoBob:anumber100◼Bobsignthenumberwithh
isprivatekey.◼AlicegetthesignednumberanddecpheritwithBob’spublickey,comparetheresult.◼Alice的challenge每
次都不一样,因此不可能重放攻击.Certificates上面的讨论基于:◼Alice认为他获得的Bob的公钥是“真的”。攻击者常会假冒因此需要一个方法来保证这一点,保证你得到的证书是可以信赖的。这个方法就是:证书机制,所有的证书都经过颁发者的私钥签名,因此是可以信赖的。发放证书的机构
就是:PKI-公开密钥基础设施Certificates证书是一种验证服务器身份的电子手段。◼客户端可以通过检查证书确认自己连接到了正确的服务器上。证书被预先存放在客户端数据库或一个证书权威(certificate
authority)处,通过比较可以验证一个收到的证书是否正确。证书一般由第三方颁布。◼证书有期限。◼你可以颁布自己的证书并分发给允许访问你站点的用户。PKI:公开密钥基础设施◼证书管理◼认证◼完整性◼机密性“外患”•AspectsofSecurity•AuthenticationandEncr
yption•InternetFirewallsandPacketFiltering•VirtualPrivateNetworks•SecureHTTP(SHTTP)andSecureSocketLayer(S
SL)•SecuringyourSiteInternetfirewall加密技术并不能解决所有的安全问题,还需要其他技术的配合.对内网的每台计算机都施加保护代价太大。Bettercreateaprotectivewall防火墙技术帮助保护内网不被unwantedInternettraff
ic所骚扰.防火墙通常放在内网与Internet之间,防止问题从Internet扩散到内部。防火墙的要点所有进入内网的流量必须经过防火墙所有离开内网的流量必须经过防火墙防火墙拒绝任何违反内网安全规则的流量防火墙本身对安全攻击有免疫力。Ifanorganizationhasmultipl
eInternetconnections,afirewallshouldbeplacedoneach包过滤Packetfiltering是防火墙采用的主要机制防火墙检查所有进出的IP包,从而控制内网与外界的联系,同时也控制外网与内网的通信。基于IP包中的源/目的地址来决
定是否丢弃某个包。过滤服务filteringservice除了低级的IP地址包过滤,还可检查包的协议或其他高层服务即实施基于服务的过滤Example:allowHTTPandSMTPandFTPonly实现的方法:Canuseabooleancombination
ofdestination,sourceandservices.FirewallwithPacketFiltering“外患”•AspectsofSecurity•AuthenticationandEnc
ryption•InternetFirewallsandPacketFiltering•VirtualPrivateNetworks•SecureHTTP(SHTTP)andSecureSocketLayer(SSL)•SecuringyourSite
PrivateNetworksPlus&MinusofPrivateNetworks专线连接站点:完全的安全性。(completelyprivate)◼Nobodyelsehasaccessorcanreadpassingdata◼租用专线==》昂贵代价Internet无法保证
confidentiality,但很便宜:justgetISPonbothends.能否同时兼得二者的好处?VirtualPrivateNetwork(VPN)VPNisimplementedinsoftwareEachrouterrunsaVPNsoftwareVPNsoftwareactsa
sapacketfilterVPNsoftwareencryptspackets,allcommunicationremainsconfidentialTunneling技术将整个报文都加密传送????如果报头加密,routerswouldn’tknoww
hoisthereceiver如果报头不加密,信息可能泄露(whoissendingandwhoisreceivingmaybeobserved)VPN使用一种称为IP-in-IPtunneling的技术来完全隐
藏信息。IP-in-IPTunneling“外患”•AspectsofSecurity•AuthenticationandEncryption•InternetFirewallsandPacketFiltering•VirtualPrivateNetworks•SecureH
TTP(SHTTP)andSecureSocketLayer(SSL)•SecuringyourSiteSecureHTTPS-HTTPrequestheader–Secure*secure-HTTP/1.1–Content-Privacy-DomainPEMorPKS-7–Content
-Type:application/http–Security-Scheme,Certificate-Info,Key-AssignS-HTTPresponseheader–Secure-HTTP/1.1200OK两个特点:协商、脆弱Negotiation
◼S-HTTP允许交互双方就安全参数进行协商◼S-HTTPallowsbothpartiestonegotiatetheirneedsandpreferencesregardingsecurityparameters(algorithm,keylength,etc.)Vulnerabilit
yS-HTTP容易受低层攻击,因为它是一个应用层的协议。S-HTTPisvulnerablesinceitissusceptibletolowlevelattacksattheTCPorIPlevel.Itissecureattheapplica
tionlevelonly.SecureSocketLayer(SSL)为了解决这个问题,SSL在OSI模型的更低层实现。◼因此,它不仅可用于HTTP,也可用于其他协议,如FTP,telnet,NNTP,etc.SSL建立并维护
一个用于通信的安全通道(securechannel)UnlikeHTTP,SSLisstateful.SecureChannelPropertiesChannelisauthenticated:服务器必须对客户端进行认证而客户端也可对服务器进行认证。认证的方法是采用public/privatek
ey进行加密。•Channelisprivate:先进行握手定义一个密钥,此后所有的消息传递都用它进行加密。加密方法是对等加密法。•Channelisreliable:Eachmessageincludesam
essageintegritycheckusingaMACSSLHandshake•DuringanSSLsession,somevariablesneedtobedefined.Theserverneedstodetermine:◼–VersionofSSLsupported(版
本)◼–Encryptionalgorithmtobeused(加密算法)◼–SessionID(eachSSLsessionhasauniqueID)(会话号)◼–Compressionalgorithmtobeused(if
needed)(压缩算法)◼–2randomnumbers以上参数在协商过程中确定下来。协商过程又称为handshake(SSL握手协议)AuthenticationalsooccursatthehandshakeHandshakeProtocolHandshakeProtocol1.浏览器发
一个clienthello消息2.服务器返回一个serverhello消息3.如果客户端需要对服务器进行认证,服务器将自己的证书(certificate)发给对方。同时可按彼此同意的加密算法发一个serverkeyexchange消息
。4.服务器向客户端请求证书(certificate)5.服务器发serverhellodone消息6.如果客户端发会证书或发回nocertificatealert消息,还将发送一个clientkeyexchange消息HandshakeProtocol7.如果一切正常,客户端发送一个chang
ecipherspec消息,同时附带同意的参数。8.客户端发finished消息9.服务器发自己的changecipherspec消息10.服务器发finished消息“内忧”对内部后台信息系统的保护◼更难防备主要安全原
则◼Leastpriviledgeprinciples◼SeparationofDuty◼Dataabstraction完成机制:访问控制(AccessControl)安全策略最早使用访问控制方法的两种:军用:MAC(Man
datoryAccessControls)◼军方应用的安全目标:preventingtheunauthorizedobservationofclassifiedinformation.民用:DAC(Discretin
aryAccessControls)◼Integritydealswithbroaderissuesofsecritythanconfidentiality◼特别是:fundstransfer,clinicalmedicine
,environmentalresearch,airtrafficcontrol等行业◼每个企业都有自己唯一的安全需求,传统的DAC和MAC难以满足要求。安全策略DAC的定义:◼ameansofrestricti
ngaccesstoobjectsbasedontheidentityofsubjectsand/orgroupstowhichtheybelong.◼Thecontrolsarediscretinaryinthesensethatasubjectwi
thacertainaccesspermissioniscapableofpassingthatpermission(perhanpsindirectly)ontoanyothersubject(unlessrestrainedbymandatorya
ccesscontrol)◼一言蔽之,DAC的特点是:用户可不经批准的把自己拥有的权限批准给其他人使用。安全策略MAC的定义:◼ameansofrestrictingaccesstoobjectsbasedonthesensit
ivity(asrepresentedbyalabel)oftheinformationcontainedintheobjectsandtheformalauthorization(I.eclearance)ofsubjectstoaccessinforam
tionofsuchsensitivity.◼强调的是:严格限制什么级别的人访问什么级别的信息。RBACPermissonsareassociatedwithrolesandusersaremadmembersofappropriat
erols.更自然,符合组织管理方式.greatlysimplifiesmanagementofpermissions.与DAC的主要不同:Theusercannotpassaccesspermissionso
ntootherusersattheirdiscretion.更像MACMAC关心的是whocanreadwhatinformation.信息绝对不可从高级流向低级权限.RBAC更关心保护信息的Integrity,也就是“Whocanperformwhatactsonwh
atinformation”符合安全三原则Securingyoursite:BasicStepsConsiderProblemswithCGIBecarefulwhatsortofscriptscan
beuploadedontheserverValidateinputofFormsandbestrict•Ex:“/usr/lib/sendmailuser”anduseris“john.smith@somewhere.ca;rmindex.html”InPerlorotherlang
uages,thiscouldbeexecutedbythesystemaftersendingthee-mailsummaryPKI技术可以有效防止用户的非法访问和修改数据等问题.但在浏览器客户端实施尚不完善要保护内部后台数据库的安全,
可以实施RBAC的策略,如果要进一步提供基于工作流的访问控制,也可在RBAC的基础上完成..