<- Back to Software Development

Popular Software Security Attacks

June 22, 20266 min read
Share

Software security attacks usually happen because an application trusts the wrong input, exposes the wrong data, or gives users more power than they should have. This log gives a brief introduction to common attacks so the basic idea is easier to recognize when reading security materials, building APIs, or reviewing code.

Short Answer

Most common software attacks are not magic. They usually abuse one of these areas:

Attack AreaMain Idea
Input attackSend dangerous input to make the system behave wrongly
Authentication attackPretend to be another user
Authorization attackAccess something without permission
Session attackSteal or abuse login state
Network attackRead, modify, or interrupt communication
Dependency attackAttack the third-party packages used by the app
Social attackTrick humans instead of directly attacking code

Security means reducing trust, validating boundaries, and assuming attackers will try abnormal inputs and abnormal flows.

Injection Attacks

Injection means the attacker sends input that becomes part of a command, query, or script.

Common examples:

AttackBrief Concept
SQL InjectionThe attacker injects SQL into user input to read, modify, or delete database data
Command InjectionThe attacker injects operating system commands into an app that calls shell commands
LDAP InjectionThe attacker manipulates LDAP queries used for directory authentication
NoSQL InjectionThe attacker changes NoSQL query behavior using crafted JSON or object input

Example idea:

Normal input:
email = user@example.com

Malicious input:
email = ' OR '1'='1

The core problem is that the system treats user input as executable logic instead of plain data.

Cross-Site Scripting

Cross-Site Scripting, or XSS, happens when an attacker injects malicious JavaScript into a page viewed by other users.

TypeBrief Concept
Stored XSSMalicious script is saved in the database and shown later
Reflected XSSMalicious script comes from the request and appears immediately in the response
DOM XSSBrowser-side JavaScript modifies the page unsafely using attacker-controlled data

XSS is dangerous because JavaScript runs inside the victim's browser. It may steal tokens, read page content, or perform actions as the user.

Cross-Site Request Forgery

Cross-Site Request Forgery, or CSRF, tricks a logged-in user's browser into sending a request to a trusted website.

The attacker does not need to know the user's password. The attack abuses the fact that the browser automatically includes cookies.

Example flow:

User logs in to bank.com
User visits attacker.com
attacker.com makes the browser send a request to bank.com
bank.com sees valid cookies and may accept the request

CSRF mainly targets cookie-based session systems.

Authentication Attacks

Authentication attacks try to prove identity incorrectly.

AttackBrief Concept
Brute ForceTrying many passwords until one works
Credential StuffingUsing leaked username-password pairs from other websites
Password SprayingTrying one common password against many accounts
PhishingTricking users into giving their login details
MFA FatigueSpamming MFA prompts until the user approves one

The target is not always the code. Sometimes the target is the user, password habit, or login workflow.

Authorization Attacks

Authorization attacks happen after identity is known, but permission checking is weak.

AttackBrief Concept
IDORChanging an ID in the URL or request to access another user's data
Privilege EscalationA low-permission user gains admin or higher access
Broken Access ControlThe server does not properly check whether the user can perform the action

Example:

/api/orders/1001
/api/orders/1002

If user A can change the ID and read user B's order, that is an authorization problem.

Session And Token Attacks

Session attacks target the proof that a user is already logged in.

AttackBrief Concept
Session HijackingStealing a session cookie or token and using it as the victim
Session FixationForcing the victim to use an attacker-known session ID
JWT TheftStealing a JWT from local storage, logs, or unsafe frontend code
Replay AttackReusing a captured request or token to repeat an action

A password proves login once. A session or token proves login repeatedly. That is why stolen sessions are serious.

Network Attacks

Network attacks target communication between systems.

AttackBrief Concept
Man-in-the-MiddleAttacker sits between client and server to read or change traffic
Packet SniffingCapturing network traffic to inspect sensitive data
DNS SpoofingSending users to the wrong server by manipulating DNS answers
TLS DowngradeForcing weaker encryption so traffic becomes easier to attack

TLS/HTTPS helps protect data in transit, but misconfiguration can still create risk.

Denial-of-Service Attacks

Denial-of-Service, or DoS, means making a service unavailable.

AttackBrief Concept
DoSOne attacker overloads a service
DDoSMany machines overload a service together
Application DoSExpensive requests consume CPU, memory, database, or external APIs
Rate Limit BypassAttacker avoids request limits using many IPs, accounts, or tokens

The goal is not to steal data. The goal is to break availability.

File And Upload Attacks

Upload features are common attack surfaces.

AttackBrief Concept
Malicious File UploadUploading executable or dangerous files
Path TraversalUsing paths like ../ to read files outside the allowed folder
Zip BombUploading a compressed file that expands into huge data
MIME SpoofingPretending a dangerous file is a harmless image or document

Any system that accepts files must treat file name, file type, file size, and file content as untrusted.

Dependency And Supply Chain Attacks

Modern software depends on many packages. Attackers can target those packages instead of the application directly.

AttackBrief Concept
Vulnerable PackageThe app uses a dependency with a known security bug
TyposquattingA fake package uses a name similar to a real package
Dependency ConfusionThe system installs a malicious public package instead of a private one
Malicious UpdateA trusted package update introduces harmful code

This is why dependency scanning, lockfiles, and careful package review matter.

Misconfiguration Attacks

Many security issues come from bad settings, not complex hacking.

MisconfigurationBrief Concept
Public Storage BucketPrivate files are accidentally exposed
Default PasswordAdmin tools still use default credentials
Exposed Debug PageDebug routes leak environment or system data
Over-Permissive CORSBrowsers are allowed to send requests from unsafe origins
Leaked SecretAPI keys or tokens are committed to GitHub or logs

Misconfiguration is dangerous because the system may be working correctly from a functional view while being insecure.

The Main Principle

Most attacks exploit misplaced trust.

Do not trust user input, frontend checks, request IDs, cookies, headers, filenames, package names, or default settings blindly. A secure system validates input, checks permission on the server, protects sessions, limits expensive work, keeps dependencies updated, and assumes every boundary can be attacked.

软件安全攻击通常不是很神秘。大多数攻击都是利用系统错误地相信了某些东西,例如相信用户输入、相信前端传来的 ID、相信 cookie、相信文件名,或者相信默认配置。这个 log 主要做一个简短概念介绍,帮助你先认识常见攻击类型。

Short Answer

常见软件攻击大多集中在这些方向:

攻击范围核心意思
输入攻击传入危险 input,让系统执行错误行为
身份认证攻击假装成另一个用户
权限攻击没有权限却访问到资源
Session 攻击偷走或滥用登录状态
网络攻击读取、修改或干扰通信
依赖攻击攻击项目使用的第三方 package
社工攻击不直接打代码,而是骗用户或管理员

安全的核心不是相信系统正常流程,而是要思考攻击者会不会走异常流程。

Injection Attacks

Injection 是指攻击者把危险 input 注入到 query、command 或 script 里面,让系统把 input 当成真正的逻辑执行。

常见类型:

攻击简短概念
SQL Injection注入 SQL,读取、修改或删除数据库数据
Command Injection注入操作系统命令,让服务器执行危险 command
LDAP Injection修改 LDAP 查询逻辑,影响目录认证
NoSQL Injection用特殊 JSON 或 object input 改变 NoSQL 查询行为

例子:

正常 input:
email = user@example.com

恶意 input:
email = ' OR '1'='1

问题本质是:系统没有把用户输入当成普通数据,而是让它变成了可执行逻辑的一部分。

Cross-Site Scripting

Cross-Site Scripting,也叫 XSS,是指攻击者把恶意 JavaScript 放进网页,让其他用户打开页面时执行这段脚本。

类型简短概念
Stored XSS恶意脚本被存进数据库,之后展示给其他用户
Reflected XSS恶意脚本从 request 进来,然后马上出现在 response
DOM XSS前端 JavaScript 用不安全方式修改页面,导致脚本执行

XSS 危险的原因是脚本会在受害者 browser 里面运行,所以它可能偷 token、读取页面内容,或者用用户身份发请求。

Cross-Site Request Forgery

Cross-Site Request Forgery,也叫 CSRF,是指攻击者诱导已经登录的用户浏览器,向可信网站发送请求。

攻击者不一定需要知道密码。它利用的是 browser 会自动带上 cookie 这个行为。

流程大概是:

用户登录 bank.com
用户打开 attacker.com
attacker.com 让浏览器发送 request 到 bank.com
bank.com 看到 cookie 有效,可能就接受这个 request

CSRF 主要攻击基于 cookie 的 session 系统。

Authentication Attacks

Authentication attack 的目标是错误地证明“我是这个用户”。

攻击简短概念
Brute Force不断尝试大量密码,直到猜中
Credential Stuffing使用其他网站泄露的账号密码来登录
Password Spraying用一个常见密码尝试大量账号
Phishing伪造网站或信息,骗用户输入账号密码
MFA Fatigue一直发送 MFA 请求,直到用户误点同意

这类攻击不一定是代码漏洞,也可能是用户习惯、密码复用、登录流程设计的问题。

Authorization Attacks

Authorization attack 发生在系统已经知道你是谁之后,但权限检查做得不够严格。

攻击简短概念
IDOR改 URL 或 request 里面的 ID,访问其他人的资料
Privilege Escalation低权限用户获得更高权限
Broken Access ControlServer 没有正确检查用户能不能执行某个动作

例子:

/api/orders/1001
/api/orders/1002

如果 user A 只改了 ID 就能看到 user B 的订单,那就是权限控制问题。

Session And Token Attacks

Session attack 主要攻击用户已经登录之后的证明。

攻击简短概念
Session Hijacking偷走 session cookie 或 token,然后冒充用户
Session Fixation强迫用户使用攻击者已知的 session ID
JWT Theft从 local storage、日志或不安全前端代码偷 JWT
Replay Attack重放已捕获的 request 或 token,重复执行动作

密码通常只用来登录一次。Session 或 token 会被重复用来证明登录状态,所以一旦被偷,风险很高。

Network Attacks

Network attack 主要攻击系统之间的通信。

攻击简短概念
Man-in-the-Middle攻击者站在 client 和 server 中间,读取或修改流量
Packet Sniffing捕获网络包,查看里面的敏感数据
DNS Spoofing篡改 DNS 结果,让用户去到错误 server
TLS Downgrade强迫系统使用较弱加密,降低通信安全性

TLS/HTTPS 可以保护传输中的数据,但如果配置错误,还是可能出现风险。

Denial-of-Service Attacks

Denial-of-Service,也叫 DoS,目标是让服务不可用。

攻击简短概念
DoS一个攻击来源把服务打爆
DDoS很多机器一起把服务打爆
Application DoS用很昂贵的 request 消耗 CPU、memory、database 或外部 API
Rate Limit Bypass用多个 IP、账号或 token 绕过请求限制

这类攻击不一定要偷数据。它的目标是破坏 availability。

File And Upload Attacks

文件上传功能也是常见攻击入口。

攻击简短概念
Malicious File Upload上传可执行文件或危险文件
Path Traversal使用 ../ 这类路径读取允许范围外的文件
Zip Bomb上传一个解压后极大的压缩包
MIME Spoofing把危险文件伪装成图片或普通文档

只要系统接收文件,就不能完全相信文件名、文件类型、文件大小和文件内容。

Dependency And Supply Chain Attacks

现代软件会依赖很多 package。攻击者不一定直接攻击你的 app,也可以攻击你使用的依赖。

攻击简短概念
Vulnerable Package项目使用了有已知漏洞的 dependency
Typosquatting发布一个名字很像正版 package 的恶意 package
Dependency Confusion系统误装了 public 恶意 package,而不是 private package
Malicious Update原本可信的 package 在某次 update 中加入恶意代码

这就是为什么 dependency scanning、lockfile 和 package review 很重要。

Misconfiguration Attacks

很多安全问题不是复杂攻击,而是配置错误。

配置问题简短概念
Public Storage Bucket原本私有的文件被公开访问
Default Password管理工具还在使用默认密码
Exposed Debug PageDebug 页面泄露环境变量或系统资料
Over-Permissive CORS允许不安全 origin 发请求
Leaked SecretAPI key 或 token 被 commit 到 GitHub 或写进日志

Misconfiguration 很危险,因为系统功能上看起来是正常的,但安全边界已经坏了。

The Main Principle

大多数攻击都是在利用系统错误的信任。

不要盲目信任 user input、frontend check、request ID、cookie、header、filename、package name 和 default setting。安全系统应该在 server 端验证 input、检查权限、保护 session、限制昂贵操作、更新依赖,并且假设每一个边界都有可能被攻击。