Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3969

HeaderTokenParser doesn't parse correctly values which includes a quote

    XMLWordPrintable

Details

    • Hide
      1. allow plain passwords for management realm authentication & reload server
        bin/jboss-cli.sh -c <<EOT
        /core-service=management/security-realm=ManagementRealm/authentication=properties:write-attribute(name=plain-text,value=true)
        reload
        EOT
        
      2. add the new user to mgmt-users.properties
        echo 'a"b=anil' >> standalone/configuration/mgmt-users.properties
        
      3. try to authenticate to HTTP management interface e.g.
        http://127.0.0.1:9990/management?operation=attribute&name=server-state
        and use following credentials:
        Username: a"b
        Password: anil

      Results in failed authentication. Log file contains:

      java.lang.IllegalArgumentException: UT000025: Unexpected token 'b", realm' within header.
      	at io.undertow.util.HeaderTokenParser.parseHeader(HeaderTokenParser.java:67)
      	at io.undertow.security.impl.DigestAuthorizationToken.parseHeader(DigestAuthorizationToken.java:79)
      	at io.undertow.security.impl.DigestAuthenticationMechanism.authenticate(DigestAuthenticationMechanism.java:144)
      	at org.jboss.as.domain.http.server.security.AuthenticationMechanismWrapper.authenticate(AuthenticationMechanismWrapper.java:57)
      	at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(SecurityContextImpl.java:281)
      	at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(SecurityContextImpl.java:298)
      	at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.access$100(SecurityContextImpl.java:268)
      	at io.undertow.security.impl.SecurityContextImpl.attemptAuthentication(SecurityContextImpl.java:131)
      	at io.undertow.security.impl.SecurityContextImpl.authTransition(SecurityContextImpl.java:106)
      	at io.undertow.security.impl.SecurityContextImpl.authenticate(SecurityContextImpl.java:99)
      	at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:50)
      	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197)
      	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:737)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      
      Show
      allow plain passwords for management realm authentication & reload server bin/jboss-cli.sh -c <<EOT /core-service=management/security-realm=ManagementRealm/authentication=properties:write-attribute(name=plain-text,value= true ) reload EOT add the new user to mgmt-users.properties echo 'a"b=anil' >> standalone/configuration/mgmt-users.properties try to authenticate to HTTP management interface e.g. http://127.0.0.1:9990/management?operation=attribute&name=server-state and use following credentials: Username: a"b Password: anil Results in failed authentication. Log file contains: java.lang.IllegalArgumentException: UT000025: Unexpected token 'b", realm' within header. at io.undertow.util.HeaderTokenParser.parseHeader(HeaderTokenParser.java:67) at io.undertow.security.impl.DigestAuthorizationToken.parseHeader(DigestAuthorizationToken.java:79) at io.undertow.security.impl.DigestAuthenticationMechanism.authenticate(DigestAuthenticationMechanism.java:144) at org.jboss.as.domain.http.server.security.AuthenticationMechanismWrapper.authenticate(AuthenticationMechanismWrapper.java:57) at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(SecurityContextImpl.java:281) at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(SecurityContextImpl.java:298) at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.access$100(SecurityContextImpl.java:268) at io.undertow.security.impl.SecurityContextImpl.attemptAuthentication(SecurityContextImpl.java:131) at io.undertow.security.impl.SecurityContextImpl.authTransition(SecurityContextImpl.java:106) at io.undertow.security.impl.SecurityContextImpl.authenticate(SecurityContextImpl.java:99) at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:50) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:737) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang. Thread .run( Thread .java:745)

    Description

      The header parser doesn't work correctly if a parsed value contains quote character ("). The problem is, the parser is in phase of searching a LAST_QUOTE and it doesn't check if the found quote character is escaped or not.

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            josef.cacek@gmail.com Josef Cacek (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: