Security: Hardening against RCE via Signed Msgpack Migration and Path Sanitization#6589
Open
JoshuaProvoste wants to merge 6 commits intogoogleapis:mainfrom
Open
Security: Hardening against RCE via Signed Msgpack Migration and Path Sanitization#6589JoshuaProvoste wants to merge 6 commits intogoogleapis:mainfrom
JoshuaProvoste wants to merge 6 commits intogoogleapis:mainfrom
Conversation
… enforcement (cleaned up)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compliance with CONTRIBUTING.md:
Consistently with the project guidelines, this PR includes:
Vector #2: Staging Bucket Spec Injection andVector #3: UNC/SMB Path Injection) and verified their neutralization by the new security infrastructure.isortandpyinkacross all modified files.setup.pyto includemsgpackas a core security requirement.Description
This PR addresses critical security vulnerabilities in the
google-cloud-aiplatformSDK involving insecure deserialization and path injection. The current implementation relies onpickleandcloudpicklefor loading model artifacts and agent states, which allows for Remote Code Execution (RCE) via malicious payloads or SMB/UNC path redirection.To remediate this, I have transitioned the SDK to a "Secure by Default" architecture using Signed Msgpack. All artifacts are now verified via HMAC-SHA256 signatures before processing, and networked paths are strictly sanitized to block external injection vectors.
Key Benefits:
msgpackreplaces execution-capable formats likepickle.Technical Implementation Details
sign_blobandverify_blobusing HMAC-SHA256.validate_urito block UNC/SMB paths (e.g.,gs:////attacker/share).SklearnPredictorandXgboostPredictorto prioritizemodel.msgpackand explicitly block insecure.pkland.joblibsinks.cloudpickledependency and replaced it with a signedmsgpackmanifest for state persistence.validate_uriinto the central GCS path validation logic to protect all download operations.msgpack >= 1.0.0toinstall_requires.Verification Performed
staging_bucketparameter could trigger RCE via pickle injection (Vector #2).AIP_STORAGE_URIcould leak NTLM hashes (Vector #3).msgpackpayloads with aRuntimeError.isortandpyinkon all reformatted files.Checklist
RCE Vector #2andVector #3.