The vulnerability GHSA-46g3-37rh-v698 in step-security/harden-runner allows for egress policy bypass via DNS over HTTPS. The investigation started by analyzing the provided patch information for harden-runner. The fix in harden-runner was to upgrade the version of its dependency, step-security/agent, from v0.14.3 to v0.14.4. This indicates the root cause of the vulnerability lies within the step-security/agent repository.
By comparing the commits between v0.14.3 and v0.14.4 of step-security/agent, the key change was identified in the firewall.go file, specifically within the addBlockRules function. Before the patch, this function created a broad iptables rule that allowed any process to make outbound connections to the specified DNS servers. This created a loophole where an attacker with code execution within the GitHub Actions workflow could use DNS-over-HTTPS to exfiltrate data, bypassing the intended network restrictions.
The patch mitigates this by adding a UID-based owner check (--uid-owner) to the iptables rule. This ensures that only the agent process itself is permitted to communicate with the DNS servers for legitimate DNS resolution, effectively closing the exfiltration channel for other processes running in the workflow. Therefore, the main.addBlockRules function in step-security/agent is the identified vulnerable function.