The vulnerability lies in OpenSearch's Field Level Security (FLS) implementation, specifically in how it handles field exclusions for nested JSON objects. When an FLS rule was configured to exclude an entire object (e.g., ~my_object), the system would correctly remove the object from the _source field in search results. However, it failed to prevent search operations on the sub-fields of that object (e.g., my_object.sensitive_field).
An attacker with search permissions could exploit this flaw by performing operations like range queries, term queries, or aggregations directly on the sub-fields. This would allow them to infer or reconstruct the values of the supposedly protected data, bypassing the intended security control and leading to unauthorized information disclosure.
The root cause was that the code only checked for an exact match of the field name against the exclusion list. It did not recursively check if a field's parent object was excluded. The fix, implemented in the DlsFlsFilterLeafReader class, introduces a new method, isFieldExclude, which traverses up the object path of a given field to check for exclusions. This corrected logic is now applied across all functions responsible for providing field data for both search and retrieval, such as getFieldInfos, getPointValues, and the various DocValues getters, ensuring that FLS rules on objects are properly enforced on their sub-fields as well.