Removing header remapping from Amazon API Gateway, and notes about our work with security researchers
{We very rarely make significant changes or take functionality out of production services at Amazon Web Services( AWS ) because we value our customers’ trust in our APIs and service functionality.|We very rarely make significant changes or take functionality out of production services at Amazon Web Services( AWS ) because our APIs and service functionality are a promise to our customers.|We very rarely make significant changes or remove functionality from production services at Amazon Web Services( AWS ) because we value our customers’ trust in our APIs and service functionality.} {When {destructive|problematic} changes are made or {features|efficiency|operation|flexibility} is removed, the {upstream|inland} effects {may|does|you|is} {become|get|remain} significant. {Clients|Consumers|Buyers|Users} use the AWS Cloud to create solutions for their customers.|When {destructive|problematic} changes are made or {features|efficiency|operation|flexibility} is removed, the {upstream|inland} effects {may|does|you|is} {become|get|remain|been} significant because {clients|consumers|buyers|users} use the AWS Cloud to create solutions for their customers.|When {destructive|problematic} changes are made or {features|efficiency|operation|flexibility} is removed, the repercussions can be significant. {Clients|Consumers|Buyers|Users} use the AWS Cloud to create solutions for their customers.} {We have personally experienced the effects of these kinds of {modifications|adjustments|alterations|shifts} as {contractors|developers|engineers}, and we make every effort to {prevent|avert|evade|minimize} these circumstances whenever {feasible|achievable|probable}.|As {contractors|developers|engineers}, we have personally experienced the effects of these kinds of {modifications|alterations|shifts}, and we make every effort to stay out of them whenever we can.|As {contractors|developers|engineers}, we have personally experienced the effects of these kinds of {modifications|alterations|shifts}, and we make every effort to stay out of them whenever feasible.}
<p>When we do need to make breaking changes, we try to provide a smooth path forward for customers who were using the old functionality. Often that means changing the behavior for new users or new deployments, and then allowing a transition window for existing customers to migrate from the old to the new behavior. There are many examples of this pattern, such as <a href="https://aws.amazon.com/blogs/security/announcing-an-update-to-iam-role-trust-policy-behavior/" target="_blank" rel="noopener">an update to IAM role trust policy behavior</a> that we made last year. </p> <p>This post explains one such recent change that we’ve made in <a href="https://aws.amazon.com/api-gateway/" target="_blank" rel="noopener">Amazon API Gateway</a>. We also discuss how we work with the security research community to improve things for customers.</p> <h2>Summary and customer impact</h2> <p>Recently, researchers at <a href="https://partners.amazonaws.com/partners/001E000000Rl0xZIAR/Omegapoint" target="_blank" rel="noopener">Omegapoint</a> disclosed an edge case issue with how API Gateway handled HTTP header remapping with custom authorizers based on <a href="https://aws.amazon.com/lambda/" target="_blank" rel="noopener">AWS Lambda</a>. As is often the case with security research, this work generated a second, tangentially related authorization-caching issue that the Omegapoint team also reported.</p> <p>After analyzing these reports, the API Gateway team decided to remove a documented feature from the service and to adjust another behavior to improve service behavior. We’ve made the appropriate changes to the <a href="https://docs.aws.amazon.com/apigateway/index.html" target="_blank" rel="noopener">API Gateway documentation</a>.</p> <p>As of June 14, 2023, the header remapping feature is no longer available in API Gateway. Customers can still use Velocity Template Language-based (VTL) transformations for header remapping, because this approach wasn’t impacted by the reported issue. If you’re using this design pattern in API Gateway and have questions about this change, reach out to your AWS support team.</p> <p>The authorization-caching behavior was working as originally designed; but based on the report, we’ve adjusted it to better meet customer expectations.</p> <p>The team at Omegapoint has published their findings in the blog post <a href="https://securityblog.omegapoint.se/en/writeup-apigw/" target="_blank" rel="noopener">Writeup: AWS API Gateway header smuggling and cache confusion</a>.</p> <p>Before we removed the feature, we contacted customers who were using the direct HTTP header remapping feature through email and the <a href="https://aws.amazon.com/premiumsupport/technology/aws-health-dashboard/" target="_blank" rel="noopener">AWS Health Dashboard</a>. If you haven’t been contacted, no action is required on your part.</p> <h2>More details</h2> <p>The main issue that Omegapoint reported was related to a documented, client-controlled HTTP header remapping feature in API Gateway. This feature allowed customers to use one set of header values in the interaction between their clients and API Gateway, and a different set of header values from API Gateway to the backend. The client could send two sets of header values: one for API Gateway and one for the backend. API Gateway would process both sets, but then remap (overwrite) one set of values with another set. This feature was especially useful when allowing newly created API Gateway clients to continue to work with legacy servers whose header-handling logic couldn’t be modified.</p> <p>The report from Omegapoint highlighted that customers who relied on Lambda authorizers for request-based authorization could be surprised when the remapping feature was used to overwrite header values that were used for further authorization on the backend, which could potentially lead to unintended access. The Lambda authorizer itself worked as expected on unmapped headers, but if there was additional authorization logic in the backend, it could be impacted by a misbehaving client.</p> <p>The second issue that Omegapoint reported was related to the caching behavior in API Gateway for authorization policies. Previously, the caching method might reuse a cached authorization with a different value when the <span></span> value was used in the request header within the time-to-live (TTL) of the cached value. This was the expected behavior of the wildcard value.</p> <p>However, after reviewing the report, we agreed that it could surprise customers, and potentially allow misbehaving clients to bypass expected authorization. We were able to change this behavior without customer impact, because there is no evidence of customers relying on this behavior. So now, cached authorizations are no longer used in the <span></span> case.</p> <h2>How we work with researchers</h2> <p>Security researchers regularly submit <a href="https://aws.amazon.com/security/vulnerability-reporting/" target="_blank" rel="noopener">vulnerability reports</a> to AWS Security. Some researchers are independent, some work in academic institutions, and others work in <a href="https://aws.amazon.com/partners/" target="_blank" rel="noopener">AWS partner</a> or customer organizations. Our Outreach team triages submissions rapidly. Upon receipt, we start a conversation and work closely with researchers to understand their concerns, give our perspective, and agree on the best path forward.</p> <p>If technical changes are required, our services and security teams work together to determine and implement the appropriate remediations based on the potential impact. They work with affected customers to reduce or eliminate impacts, and they work with the researchers to coordinate the publication of their findings.</p> <p>Often these reports highlight situations where the designed and documented behavior might result in a surprising outcome for some customers. In those cases, we work with the researcher to make the appropriate updates to the documentation, if needed, and help ensure that the researcher’s finding is published with customer education as the primary goal.</p> <p>In other cases, where warranted, we communicate about security issues to the broader customer and security community by using a security bulletin. Finally, we publish security blog posts in cases where providing more context makes sense, such as the current issue.</p> <p>Security is our top priority, and working with the community to make our customers and the AWS Cloud safer is a key part of that. Clear communication helps build understanding and trust.</p> <h2>Working together</h2> <p>We removed the direct remapping feature because not many customers were using it, and we felt that documentation warning against the impacted design choices provided insufficient visibility and protection for customers. We designed and released the feature in an era when it was reasonable to assume that an API Gateway client would be well-behaved, but as times change, it now makes sense that an API client could be potentially negligent or even hostile. There are multiple alternative approaches that can provide the same outcome for customers, but in a more expected and controlled manner, which made this a simpler process to work through.</p> <p>When researchers report potential security findings, we work through our process to determine the best outcome for our customers. In most cases, we can adjust designs to address the issue, while maintaining the affected features.</p> <p>In rare cases, such as this one, the more effective path forward is to sunset a feature in favor of a more expected and secure approach. This is a core principle of evolving architectures and building resilient systems. It’s something that we practice regularly at AWS and a key principle that we share with our customers and the community through the <a href="https://aws.amazon.com/architecture/well-architected/" target="_blank" rel="noopener">AWS Well-Architected Framework</a>.</p> <p>Our thanks to the team at Omegapoint for reporting these issues, and to all of the researchers who continue to work with us to help make the AWS Cloud safer for our customers.</p> <p><strong>Want more AWS Security news? Follow us on <a title="Twitter" href="https://twitter.com/AWSsecurityinfo" target="_blank" rel="noopener noreferrer">Twitter</a>.</strong></p> <!-- '"` -->