Skip to content

Remove toa field, fix security vulnerability.#925

Merged
ywc689 merged 1 commit intoiqiyi:develfrom
cfc4n:remove_toa
Dec 8, 2023
Merged

Remove toa field, fix security vulnerability.#925
ywc689 merged 1 commit intoiqiyi:develfrom
cfc4n:remove_toa

Conversation

@cfc4n
Copy link
Contributor

@cfc4n cfc4n commented Nov 29, 2023

存在一定安全风险,具体细节等未来用户升级完成后公布。

UPDATE(2024-08):

漏洞详情:https://mp.weixin.qq.com/s/B4y3JV6_Jb0ew9u1vVGE4g


/* Sometimes, the backend dpvs system allows toa data filled by the previous dpvs system. e.g.: LB --> LB --> RS
* But disabled default. 0: disable, 1: enable; etc. */
int dpvs_use_client_toa = 0;
Copy link
Collaborator

@ywc689 ywc689 Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 这个参数没有配置入口;
  2. 如果这个变量只用在当前代码文件中,请使用 static 类型
  3. 原理上看,这个配置参数对dpvs 的toa没有实际意义

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1,是的,我还没想好该如何传递这个参数。
2,好
3,dpvs串联的场景,在一些大长里比较常见。前置LB需要清空,但接力的LB需要读取这个参数。我觉得有必要。除非dpvs不支持LB串联。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dpvs toa不支持串连使用

&& (opsize == tcp_opt_len)) {
for (i = 0; i < tcp_opt_len; i++)
*(ptr - 2 + i) = TCP_OPT_NOP;
return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否要考虑有多个 toa option的场景?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,有必要,我需要调整这块代码。

Comment on lines +766 to +769

if (dpvs_use_client_toa == 0) {
tcp_in_remove_toa(th, af);
}
Copy link
Collaborator

@ywc689 ywc689 Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个漏洞是不是只有在dpvs 调用 tcp_in_add_toa 失败的情况下才可能被利用?如果是这样,可以只在失败的情况下调用 tcp_in_remove_toa 以减小不必要的性能损耗。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得不是,即使添加成功,但RS上内核模块读取的逻辑是不确定的。理应前置链路确保后续安全,不应该将风险往后传递。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

内核模块的逻辑是确定的,参考 toa.ko 的代码中的 get_toa_data 函数。
https://github.com/iqiyi/dpvs/blob/master/kmod/toa/toa.c#L348C16-L348C16

@ywc689 ywc689 added the pr/to-test-codes Compile and test the patch of pr to verify if it works. label Nov 30, 2023
@ywc689 ywc689 self-assigned this Nov 30, 2023
@cfc4n
Copy link
Contributor Author

cfc4n commented Dec 1, 2023

@ywc689

已更新,请审阅。


updated , PTAL.

Comment on lines +44 to +46
/* Sometimes, the backend dpvs system allows toa data filled by the previous dpvs system.
* See https://github.com/iqiyi/dpvs/pull/925 for more detail.
* e.g.: LB --> LB --> RS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DPVS Toa还不支持这种串连使用场景。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK,已更新,去除了串联模式的相关配置。

另外,如果没问题的话,请你这里 merge时,选择squash merge吧。我这里reset 分支后,不太对,变更特别多。


/* Sometimes, the backend dpvs system allows toa data filled by the previous dpvs system. e.g.: LB --> LB --> RS
* But disabled default. 0: disable, 1: enable; etc. */
int dpvs_use_client_toa = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dpvs toa不支持串连使用

@ywc689 ywc689 changed the base branch from master to devel December 6, 2023 12:54
@ywc689 ywc689 added the pr/codes-reviewed-ok code review passed and no problem found label Dec 7, 2023
cfc4n added a commit to cfc4n/dpvs that referenced this pull request Dec 7, 2023
@cfc4n cfc4n changed the title clear the original TOA information to mitigate potential security risks. Remove toa field, fix security vulnerability. Dec 7, 2023
@cfc4n cfc4n force-pushed the remove_toa branch 2 times, most recently from 321b3d0 to e74927c Compare December 7, 2023 14:08
@ywc689 ywc689 added pr/codes-tested-ok compile ok and specified tests passed pr/accepted the pr passed all review stages and await to be merged and removed pr/to-test-codes Compile and test the patch of pr to verify if it works. labels Dec 8, 2023
@ywc689 ywc689 merged commit ab6dd16 into iqiyi:devel Dec 8, 2023
@harry-xm
Copy link

存在一定安全风险,具体细节等未来用户升级完成后公布。

请问具体细节是否可以公布了呢?

@cfc4n
Copy link
Contributor Author

cfc4n commented Jun 13, 2024

L4LB比较底层,更新比较慢,还有很多人没升级完,还需要一段时间。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr/accepted the pr passed all review stages and await to be merged pr/codes-reviewed-ok code review passed and no problem found pr/codes-tested-ok compile ok and specified tests passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants