Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization bugs #937

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/notes/面向对象思想.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Vihicle .. N
## S.O.L.I.D

| 简写 | 全拼 | 中文翻译 |
| :--: | :--: | :--: |
| :---: | :---: | :---: |
| SRP | The Single Responsibility Principle | 单一责任原则 |
| OCP | The Open Closed Principle | 开放封闭原则 |
| LSP | The Liskov Substitution Principle | 里氏替换原则 |
Expand Down
2 changes: 1 addition & 1 deletion notes/Java 基础.md
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ System.out.println(InterfaceExample.x);

使用接口:

- 需要让不相关的类都实现一个方法,例如不相关的类都可以实现 Compareable 接口中的 compareTo() 方法;
- 需要让不相关的类都实现一个方法,例如不相关的类都可以实现 Comparable 接口中的 compareTo() 方法;
geektcp marked this conversation as resolved.
Show resolved Hide resolved
- 需要使用多重继承。

使用抽象类:
Expand Down
12 changes: 12 additions & 0 deletions notes/攻击技术.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* [二、跨站请求伪造](#二跨站请求伪造)
* [三、SQL 注入攻击](#三sql-注入攻击)
* [四、拒绝服务攻击](#四拒绝服务攻击)
* [五、反序列化攻击](#五反序列化攻击)
* [参考资料](#参考资料)
<!-- GFM-TOC -->

Expand Down Expand Up @@ -185,6 +186,17 @@ ResultSet rs = stmt.executeQuery();

分布式拒绝服务攻击(distributed denial-of-service attack,DDoS),指攻击者使用两个或以上被攻陷的电脑作为“僵尸”向特定的目标发动“拒绝服务”式攻击。

# 五、反序列化攻击
反序列化攻击的本质在于Java 序列化自身的缺陷。

众所周知,序列化的目的是使Java 对象转化成字节流,方便存储或者网络上传输。Java 对象分解成字节码过程叫做序列化,从字节码组装成 Java 对象的过程叫做反序列化,这两个过程分别对应于的 writeObject 和 readObject 方法。

问题在于 readObject 在利用字节流组装 Java 对象时不会调用构造函数,也就意味着没有任何类型的检查,用户可以复写 readObject() 方法执行任何希望执行的代码。

攻击者修改过的readObject代码,通过序列化方法writeObject()转成字节流打包发送给服务端,服务端把字节流转成对象时,自动调用了这串字节流中的被恶意修改的readObject()方法,攻击者可以在这段代码里做任何事情。

2018年5月,[oracle官方宣布要废弃序列化](https://www.bleepingcomputer.com/news/security/oracle-plans-to-drop-java-serialization-support-the-source-of-most-security-bugs/)

# 参考资料

- [维基百科:跨站脚本](https://zh.wikipedia.org/wiki/%E8%B7%A8%E7%B6%B2%E7%AB%99%E6%8C%87%E4%BB%A4%E7%A2%BC)
Expand Down