{"id":9824,"date":"2020-12-11T19:42:36","date_gmt":"2020-12-11T19:42:36","guid":{"rendered":"https:\/\/staging-site.42crunch.com\/?p=9824"},"modified":"2022-11-23T10:33:10","modified_gmt":"2022-11-23T10:33:10","slug":"webinar-questions-jwt-api-security","status":"publish","type":"post","link":"https:\/\/staging2022.42crunch.com\/webinar-questions-jwt-api-security\/","title":{"rendered":"Questions Answered: How to Best Leverage JWTs or API Security"},"content":{"rendered":"
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
This attack happens when you are using an asymmetric algorithm (RSA) and the attacker replaces it with a symmetric one (HMAC like HS256 in our example.)<\/span><\/p>\n In regular use (expected by the API implementation):<\/span><\/p>\n To perform the attack, attacker:<\/span><\/p>\n See: https:\/\/www.nccgroup.com\/uk\/about-us\/newsroom-and-events\/blogs\/2019\/january\/jwt-attack-walk-through\/<\/a><\/span><\/p>\n <\/p>\n Given its insecurity, why does the specification allow for no algorithm?\u00a0 In what use case would that be applicable?\u00a0 Just testing or is there a real-world use case for no alg?<\/strong><\/p>\n \u201cNone\u201d has been added to the JWT specification mainly for testing purposes and for situations in which there has been an explicit decision by the system\u2019s architects to not sign the tokens altogether.\u00a0<\/span><\/p>\n Quoting JWT security best practices document:<\/span><\/p>\n \u201c<\/span>That said, if a JWT is cryptographically protected end-to-end by a transport layer, such as TLS using cryptographically current algorithms, there may be no need to apply another layer of cryptographic protections to the JWT. In such cases, the use of the “none” algorithm can be perfectly acceptable. The “none” algorithm should only be used when the JWT is cryptographically protected by other means. JWTs using “none” are often used in application contexts in which the content is optionally signed; then, the URL-safe claims representation and processing can be the same in both the signed and unsigned cases.<\/span>\u201d<\/span><\/p>\n We, at 42Crunch, believe in zero trust approach toward any data coming from API clients. Tokens are especially sensitive because they serve as a foundation for authentication and authorization decisions. Thus, we believe that real-life scenarios should exclude \u201cNone\u201d, pick a proper algorithm and enforce its use. Most industry vendors follow a similar approach.\u00a0<\/span><\/p>\n You can read more here:\u00a0<\/span>https:\/\/auth0.com\/blog\/critical-vulnerabilities-in-json-web-token-libraries\/<\/span><\/a><\/p>\n <\/p>\n What\u2019s the benefit for the attacker to change the algorithm? Wouldn’t changing the content break the signature anyway?<\/strong><\/p>\n The idea behind changing the algorithm is to enable attacker to forge the token signature:<\/span><\/p>\n <\/p>\n Of all the grant types, is the \u201cAuth code grant\u201d more relevant to API security and user metadata?\u00a0 What about implicit, client credentials and other types? Are they not suitable?<\/strong><\/p>\n We should probably do another webinar specifically on OAuth2 security best practices. The exact grant type to be used depends on the scenario, however, <\/span>Implicit grant and Resource Owner Password Credentials grant are no longer considered secure and should not be used.<\/span><\/p>\n Other notable OAuth2 current security best practices are:<\/span><\/p>\n See current OAuth2.1 draft for details on the current OAuth security recommendations: <\/span>https:\/\/tools.ietf.org\/html\/draft-ietf-oauth-v2-1-00<\/span><\/a>\u00a0<\/span><\/p>\n <\/p>\n Can you have specific validations per API so you know specifically what aud is allowed per API?<\/strong><\/p>\n Yes, 42Crunch allows to define audience and other JWT requirements on a per API level.<\/span><\/p>\n <\/p>\n What is the deployment model for the 42Crunch firewall which protects against these JWT attacks? Does it deploy like a gateway or closer to the application?<\/strong><\/p>\n 42Crunch firewall can be deployed both in a central gateway-style mode and as a sidecar proxy within the same pod as the microservice implementing the API.<\/span><\/p>\n <\/p>\n At the last bit, these terms were used \u201cexchange OPAQUE TOKENS with a REAL JWT TOKEN\u201d \u201cdon\u2019t send FULL TOKENS\u201d \u2014- can you expand again what the differences with those tokens.<\/strong><\/p>\n Opaque token is an identifier that can be used to retrieve full information about the caller. The API implementation then does not decode the token but rather is using it to retrieve information from some sort of an internal database or service.<\/span><\/p>\n Real JWT \/ full tokens are the JWT tokens we covered in the webinar. This is an encoded JSON structure with the actual information about the caller. Anyone decoding that token can get information contained in the token. Thus, unencrypted JWT tokens containing sensitive information should not be used in situations when the token is available to client applications and thus potentially in the attacker’s hands.<\/span><\/p>\n <\/p>\n <\/p>\n Try our security audit<\/a> for free. If you want to see the whole platform in action, request a demo now<\/a>!<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":" You had questions, and we’ve got answers! Thank you for all the questions submitted on our webinar: “How to Best Leverage JWTs or API Security” We were unable to get to your questions, so below are all the answers to the questions that were asked! If you’d like more information please feel free to contact […]<\/p>\n","protected":false},"author":13,"featured_media":11342,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":"How to Best Leverage JWTs for API Security - Q & A","_seopress_titles_desc":"Questions and answers related to our recent API security webinar on "How to Best Leverage JWTs for API Security".\r\n","_seopress_robots_index":"","site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"disabled","ast-hfb-above-header-display":"disabled","ast-hfb-below-header-display":"disabled","ast-hfb-mobile-header-display":"disabled","site-post-title":"disabled","ast-breadcrumbs-content":"disabled","ast-featured-img":"disabled","footer-sml-layout":"disabled","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[6],"tags":[16,15,40],"class_list":["post-9824","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-api-security-training","tag-api-vulnerabilities","tag-jwt"],"_links":{"self":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/posts\/9824"}],"collection":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/comments?post=9824"}],"version-history":[{"count":0,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/posts\/9824\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/media\/11342"}],"wp:attachment":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/media?parent=9824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/categories?post=9824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/tags?post=9824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
\n
<\/h5>\n
<\/h5>\n
<\/h5>\n
\n
<\/h5>\n
<\/h5>\n
\n
<\/h5>\n
<\/h5>\n
<\/h5>\n
<\/h5>\n
<\/h5>\n
<\/h5>\n