The vulnerability exists in the node-tar library and is a path traversal issue caused by inconsistent path handling for hardlink entries in a TAR archive. The core of the issue is in the Unpack.stripAbsolutePath function, which is responsible for security validation of entry paths during extraction.
The vulnerability description clearly explains that the security check for hardlinks and the actual hardlink creation use different path resolution semantics. The security check, performed in stripAbsolutePath, resolved the link path relative to the entry's directory within the archive, while the file system operation to create the link resolved it relative to the final extraction directory (cwd).
The provided patch confirms this analysis. The change in src/unpack.ts within the stripAbsolutePath function modifies the condition for checking for .. sequences. The original code, if (field === 'path'), only applied the check to file paths, completely ignoring hardlink paths (linkpath). The fix, if (field === 'path' || type === 'Link'), extends this critical security check to hardlink entries as well, preventing them from containing .. and thus resolving the path traversal vulnerability. When this vulnerability is exploited, the Unpack.stripAbsolutePath function would be present in the runtime profile as it processes the malicious TAR entry.