Commit Graph
105 Commits
Author SHA1 Message Date
Shelikhoo 807b820e7b dynamic address length calculation in shadowsocks udp encoding 2026-01-14 14:04:59 +00:00
fengweiyuanandXiaokang Wang (Shelikhoo) 876d7f7cb2 There is a buffer overflow bug in Shadowsocks UDP packet encoding. In the EncodeUDPPacket function of proxy/shadowsocks/protocol.go, a fixed-size buffer of 2048 bytes is created using buf.New().
However, the actual size of a UDP packet includes:
IV: 16 bytes (e.g., for aes-128-gcm)
Destination address: 7~258 bytes (depending on IPv4/IPv6/domain)
Payload: variable, up to 2048 bytes
AEAD authentication tag: 16 bytes
When the incoming payload is large (close to 2048 bytes), the total size exceeds the buffer capacity. When b.Extend() is called in AEADCipher.EncodePacket() to allocate space for the authentication tag, it triggers panic: extending out of bound, causing the process to crash.
Fix
Before creating the buffer, calculate the required buffer size based on IV length, maximum address length (258 bytes), payload length, and AEAD overhead (16 bytes). If the required size exceeds the default buffer size (2048 bytes), use buf.NewWithSize() to allocate a sufficiently large buffer.
2025-12-29 18:57:46 +00:00
Shelikhoo 0746740b10 add reduced entropy experiment to shadowsocks 2022-01-15 20:47:20 +00:00
Shelikhoo d068b60791 shadowsockets fullcone outbound support 2022-01-03 15:55:18 +00:00
Shelikhoo 3ef7feaeaf update version: auto replacement to v5 path 2022-01-02 15:16:23 +00:00
LoyalsoldierandGitHub dce8764fd7 Lint: fix lint (#1427)
* Lint: replace golint with revive
* Lint: fix lint
2021-11-27 17:16:41 +08:00
LoyalsoldierandGitHub 43447aa2e4 Chore: format code to fix lint (#1426) 2021-11-27 14:32:07 +08:00
JebbsandShelikhoo b05a469488 v5: Remove v2ctl & wv2ray (rebased from 7c1ab06206) 2021-09-04 11:09:55 +01:00
database64128andGitHub c78ee5aac7 🏡 Housekeeping: Update to Go 1.17 (#1215)
* ⬆ Update to Go 1.17

* 🏗 Update workflows and add windows-arm64

* 💾 Update generated files

* 📛 Update not-so-friendly filenames
2021-08-21 13:20:40 +08:00
LoyalsoldierandGitHub d7a202a705 Lint: update linter config & fix code style (#1089)
* Lint: update linter config
* Fix: code style
2021-06-22 22:36:23 +08:00
Shelikhoo 79174ab2a0 unified drain support for vmess and shadowsockets 2021-06-22 12:26:17 +01:00
Shelikhoo 7f5bc447d9 iv check should proceed after decryption 2021-04-01 20:59:36 +01:00
Shelikhoo e4681e8cd3 added shadowsockets iv check for tcp socket 2021-04-01 20:59:35 +01:00
LoyalsoldierandGitHub f94dd11a8c Chore: change module name (#677) 2021-02-17 04:31:50 +08:00
loyalsoldier 784775f689 Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
loyalsoldier 7a789fed37 Run go fmt 2020-10-04 06:29:21 +08:00
KslrandGitHub 9f344fa1c9 remove shadowsosks ota (#238)
* remove shadowsosks ota

* remove unused buf.Reader
2020-10-02 16:13:31 +08:00
loyalsoldier 1fa89b32d4 Format: run go fmt ./... 2020-08-30 21:17:22 +08:00
Shelikhoo a40727a3dc added drain for ss and improved vmess drain 2020-08-26 13:51:23 +08:00
Agioi TheodoroiandKslr bbd3988f3d clean up code 2020-06-27 07:51:42 +08:00
Darien Raymond 1ab94fed79 optimize v2ctl size 2019-02-01 20:08:21 +01:00
Darien Raymond a01fdc29a6 remove NewMultiBufferValue 2018-11-16 11:08:12 +01:00
Darien Raymond 8bb018dae2 fix encoding bug in shadowsocks 2018-11-02 22:04:52 +01:00
Darien Raymond 18ddde4fd4 fix build break in shadowsocks 2018-11-02 21:35:59 +01:00
Darien Raymond f7b96507f9 simplify buffer extension 2018-11-02 21:34:04 +01:00
Darien Raymond 58e2ed3381 remove closure on ReadFullFrom 2018-11-02 15:01:33 +01:00
Darien Raymond 54e1bb96cc introduce in-memory user 2018-08-27 00:11:32 +02:00
Darien Raymond 2e11653694 remove BufferedReader.Direct 2018-08-17 20:45:23 +02:00
Darien Raymond ebea255c74 eliminate partial writes 2018-07-28 15:03:40 +02:00
Darien Raymond 64a3333987 remove extra bytes reading 2018-07-09 17:26:43 +02:00
Darien Raymond 148a7d064d simplify buf.BufferedReader 2018-04-21 00:54:53 +02:00
Darien Raymond 3997d13b97 rename Slice and Slice from to Resize and Advance 2018-04-19 23:48:38 +02:00
Darien Raymond 1425fd2ba9 remove Buffer.Append method 2018-04-19 22:56:55 +02:00
Darien Raymond 9d7f43a299 fix lint errors 2018-04-11 16:15:29 +02:00
Darien Raymond 9f198d7e3d fix lint errors 2018-04-04 00:29:30 +02:00
Darien Raymond 4de3f1adc1 change ReadFullFrom to take int32 size 2018-04-02 00:44:47 +02:00
Darien Raymond fda85506c8 reuse buffer 2018-03-09 11:26:00 +01:00
Darien Raymond b7d48fe7c5 prevent reading 0 bytes 2018-02-26 17:50:14 +01:00
Darien Raymond af1abf687c unify all address reading and writing 2018-02-23 23:42:01 +01:00
Darien Raymond 1077e33d62 unify address reading in socks and shadowsocks 2018-02-22 10:31:08 +01:00
Darien Raymond 484bdeecc9 comments 2017-12-14 15:02:36 +01:00
Darien Raymond 81c4f23691 merge address writing 2017-12-04 00:55:34 +01:00
Darien Raymond 3aa5102036 lazy init of authenticator 2017-11-29 23:08:02 +01:00
Darien Raymond f6bb214d30 fix lint warnings 2017-11-29 22:57:18 +01:00
Darien Raymond cb68575444 support none cipher in shadowsocks 2017-11-29 22:19:04 +01:00
Darien Raymond 64e5430ed9 lazy init of authenticator 2017-11-27 10:42:51 +01:00
Darien Raymond fefb5c8e01 fix aead udp 2017-11-26 21:51:30 +01:00
Darien Raymond b64aceabcf fix aead reader and writer 2017-11-26 16:56:01 +01:00
Darien Raymond 721bea5d54 fix lint warnings 2017-11-26 15:13:33 +01:00
Darien Raymond 6c0a1439c4 fix #739 2017-11-26 14:18:23 +01:00