CWE一覧に戻る
CWE-375

信頼できない呼び出し元への変更可能オブジェクトの返却

Returning a Mutable Object to an Untrusted Caller
脆弱性 レビュー中
JA

クローン化されていない変更可能なデータを返り値として送ると、呼び出し元の関数によってそのデータが変更されたり削除されたりする可能性がある。

関数が変更可能なデータへの参照を返すような状況では、関数を呼び出した 外部コードが送信されたデータに変更を加える可能性があります。このデータが以前にクローンされたものでない場合、クラスは変更されたデータを使用することになり、その内部状態に関する仮定に違反する可能性があります。

EN

Sending non-cloned mutable data as a return value may result in that data being altered or deleted by the calling function.

In situations where functions return references to mutable data, it is possible that the external code which called the function may make changes to the data sent. If this data was not previously cloned, the class will then be using modified data which may violate assumptions about its internal state.

Scope: Access Control, Integrity / Impact: Modify Memory
Declare returned data which should not be altered as constant or immutable.
Clone all mutable data before returning references to it. This is the preferred mitigation. This way, regardless of what changes are made to the data, a valid copy is retained for use by the class.
MITRE公式ページ — CWE-375