CWE一覧に戻る
CWE-1322

シングルスレッド、ノンブロッキング・コンテキストでのブロッキング・コードの使用

Use of Blocking Code in Single-threaded, Non-blocking Context
脆弱性 作成中
JA

この製品は、シングル・スレッド・プロセスに依存するノンブロッキング・モデルを使用している。
に依存するノンブロッキング・モデルを採用している。

攻撃者がブロッキング・コードを直接呼び出すことができる場合、またはブロッキング・コードが攻撃者によって影響され得る環境条件の影響を受ける可能性がある場合、コードの予期せぬハングまたはフリーズを引き起こすことによってサービス拒否につながる可能性があります。ブロッキングコードの例としては、高価な計算や、次のような呼び出しが考えられます。
たとえば、排他的なファイル操作を実行したり、ネットワーク操作の成功を必要とするような、ブロッキング・ライブラリ・コールを呼び出すことです。

マルチスレッドモデルには限界があるため、シングルスレッド
モデルは、多数のスレッドを使用することによって生じるリソースの制約を克服するために使用される。
シングルスレッド・モデルが使用される。このようなモデルでは、すべてのコードは一般に
ノンブロッキングでなければならない。ブロッキング・コードが呼び出されると、イベント・ループは事実上停止する。
を効果的に停止させることができる。 このような
このようなモデルは、Python asyncio、Vert.x、Node.js、あるいは他のカスタム・イベント・ループ・コードで使われている。
またはその他のカスタム・イベント・ループ・コードで使用される。

EN

The product uses a non-blocking model that relies on a single threaded process
for features such as scalability, but it contains code that can block when it is invoked.

When an attacker can directly invoke the blocking code, or the blocking code can be affected by environmental conditions that can be influenced by an attacker, then this can lead to a denial of service by causing unexpected hang or freeze of the code. Examples of blocking code might be an expensive computation or calling
blocking library calls, such as those that perform exclusive file operations or require a successful network operation.

Due to limitations in multi-thread models, single-threaded
models are used to overcome the resource constraints that are caused by using
many threads. In such a model, all code should generally be
non-blocking. If blocking code is called, then the event loop will
effectively be stopped, which can be undesirable or dangerous. Such
models are used in Python asyncio, Vert.x, and Node.js, or other
custom event loop code.

Scope: Availability / Impact: DoS: Resource Consumption (CPU)
Generally speaking, blocking calls should be
replaced with non-blocking alternatives that can be used asynchronously.
Expensive computations should be passed off to worker threads, although
the correct approach depends on the framework being used.
For expensive computations, consider breaking them up into
multiple smaller computations. Refer to the documentation of the
framework being used for guidance.
MITRE公式ページ — CWE-1322