规范表示是什么意思及其对网站的潜在漏洞

发布于 2024-07-29 01:00:34 字数 76 浏览 4 评论 0原文

我在谷歌上搜索了规范表示的含义,发现了一些非常神秘的文档。 任何人都可以快速解释规范表示以及网站中针对规范表示攻击的一些典型漏洞是什么?

I searched on google for a meaning of canonical representation and turned up documents that are entirely too cryptic. Can anyone provide a quick explanation of canonical representation and also what are some typical vulnerabilities in websites to canonical representation attacks?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

别忘他 2024-08-05 01:00:34

规范化是获取输入(例如文件名或字符串)并将其转换为标准表示形式的过程。

例如,如果您的 Web 应用程序仅允许访问 C:\websites\mydomain 下的文件,则通常引用文件名的任何输入都会被规范化为物理直接路径,而不是使用相对路径的路径。 如果您想打开 C:\websites\mydomain\example\example.txt 该函数的一个输入可能是 example\example.txt。 很难确定这是否超出了网站的边界,因此规范化功能将查看应用程序目录并将相对路径更改为物理路径,即 C:\websites\mydomain\example\example.txt。 这显然更容易检查,因为您只需在文件路径的开头进行字符串比较即可。

对于 HTML 输入,您采用 %20 之类的输入并通过取消编码对其进行规范化,因此这将变成一个空格。 这是一个好主意,因为不同的编码方式有很多,规范化意味着您只需检查解码后的字符串,而不是尝试覆盖所有编码变体。

基本上,您正在接受逻辑上等效的输入,并将它们转换为标准形式,然后您可以采取行动。

Canonicalisation is the process by which you take an input, such as a file name, or a string, and turn it into a standard representation.

For example if your web application only allows access to files under C:\websites\mydomain then typically any input referring to filenames is canonicalised to be a physical, direct path, rather than one which uses relative paths. If you wanted to open C:\websites\mydomain\example\example.txt one input into that function may be example\example.txt. It's hard to work out if this goes outside the boundaries of your web site, so the canonicalisation function would look at the application directory and change that relative path into a physical one, C:\websites\mydomain\example\example.txt. This is obviously easier to check as you simply do a string compare on the start of the file path.

For HTML inputs you take inputs like %20 and canonicalise them by unencoding, so this would turn into a space. This is a good idea as the number of different ways of encoding are numerous, canonicalisation means you would check the decoded string only, rather than try to cover all the encoding variations.

Basically you are taking input which is logically equivalent and converting them to a standard form which you can then act upon.

你如我软肋 2024-08-05 01:00:34

以下解释来自此处的“应用程序安全和开发 STIG”:

3.11 规范表示
出现规范表示问题
当资源名称用于
控制资源访问。 有
多种表示方法
计算机系统上的资源名称。
仅依赖于一个应用程序
控制访问的资源名称可以
错误地进行访问控制
决定是否在中指定名称
无法识别的格式。

例如,
在 Windows 中,notepad.exe 可能是
由以下文件表示和
路径名组合:

C:\Windows\System32\notepad.exe

%SystemRoot%\System32\notepad.exe

\?\C:\Windows\System32\notepad.exe

\host\c$\Windows\system32\notepad.exe

尝试限制的应用程序
仅根据
文件路径和名称可能不正确
授予或拒绝访问。 同样的问题
可能适用于其他指定资源
一个系统,例如硬和
软链接、URL、管道、共享、
目录、设备名称或数据内
文件,如果有替代编码
机制与数据一起使用。


以下项目可能表明潜力
规范表示问题
应用:

• 访问控制
基于资源名称的决策。

• 未能将资源名称缩减为
使用前的规范形式。


为了最小化规范
中的代表性问题
应用程序,执行以下操作
程序:

• 不要仅仅依赖
用于控制访问的资源名称。

• 如果
使用资源名称来控制
访问,验证名称以确保
它们的格式正确; 拒绝
所有不符合已知名称的名称
标准。

• 使用基于操作系统的
访问控制机制,例如
权限和 ACL。

The following explanation is from the "Application Security and Development STIG" found here:

3.11 Canonical Representation
Canonical representation issues arise
when the name of a resource is used to
control resource access. There are
multiple methods of representing
resource names on a computer system.
An application relying solely on a
resource name to control access may
incorrectly make an access control
decision if the name is specified in
an unrecognized format.

For example,
in Windows, notepad.exe may be
represented by the following file and
path name combinations:

C:\Windows\System32\notepad.exe

%SystemRoot%\System32\notepad.exe

\?\C:\Windows\System32\notepad.exe

\host\c$\Windows\system32\notepad.exe

An application attempting to restrict
access to the file based solely on the
file path and name may improperly
grant or deny access. The same issue
may apply to other named resources on
a system, such as a hard- and
soft-links, URL, pipe, share,
directory, device name, or within data
files, if alternate encoding
mechanisms are used with the data.

The
following items may indicate potential
canonical representation issues in an
application:

• Access control
decisions based upon a resource name.

• Failure to reduce a resource name to
its canonical form before use.

In
order to minimize canonical
representation issues in the
application, implement the following
procedures:

• Do not rely solely on
resource names to control access.

• If
using resource names to control
access, validate the names to ensure
they are in the proper format; reject
all names not fitting the known-good
criteria.

• Use operating system-based
access control mechanisms such as
permissions and ACLs.

も星光 2024-08-05 01:00:34

规范化意味着将接收到的数据减少到最简单的形式,用于输入验证。

Canonicalisation means reducing the data received to its simplest form, it's used for Input validation.

远山浅 2024-08-05 01:00:34

规范(我认为)意味着控制台输入是“典型行为”。 非规范是指输入不标准,需要专门的知识,例如linux上“vi”的输入行为。

Canonical (I think) means that console input is "typical behavior". Non-canonical means that input is non-standard and requires special knowledge, such as the input behavior of "vi" on linux.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文