The vulnerability (CVE-2024-8616) description explicitly states that the exportModelDetails function within h2o-core/src/main/java/water/api/ModelsHandler.java is the source of the arbitrary file overwrite. The mexport.dir parameter within the ModelExportV3 object, passed to this function, is identified as user-controllable and is used to construct the file path for exporting model details.
Analysis of the provided code for ModelsHandler.java (specifically the version linked by commit 088190f9d0370a02a483fca68d8dc89c996b4f83, which corresponds to the vulnerable version 3.46.0) confirms this. The exportModelDetails method takes a ModelExportV3 mexport object. Inside this method, mexport.dir is used with FileUtils.getURI() to create a URI, which is then used by Persist.create() to open an OutputStream. This stream is subsequently used to write the model details. Since mexport.dir is user-controlled via the /99/Models/{name}/json endpoint, an attacker can craft this parameter to point to an arbitrary file path on the server, leading to a file overwrite. The function signature water.api.ModelsHandler.exportModelDetails would appear in runtime profiles during the exploitation of this vulnerability.