For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

tthomaPXL's avatar
tthomaPXL
Icon for Nimbostratus rankNimbostratus
Nov 03, 2023
Solved

issue with irule redirecting with # string

https://support.abc.int/supportnet/application.jsp#support/32 https://pxl.saas.supportsystems.com/assystnet/application.jsp#services/48 trying to create an irule to redirect the top site to the bot...
  • Niels_van_Sluis's avatar
    Nov 04, 2023

    In addition to what Paulius says, you can try the iRule below.

    when HTTP_REQUEST {
        # Disable the stream filter by default   
        STREAM::disable 
     
        # LTM does not uncompress response content, so if the server has compression enabled
        # and it cannot be disabled on the server, we can prevent the server from
        # sending a compressed response by removing the compression offerings from the client
        HTTP::header remove "Accept-Encoding"
        
        if { [HTTP::uri] starts_with "/f5/anchor_link_redirect" } {
            set href [b64decode [URI::query [HTTP::uri] href]]
            if { $href equals "https://support.abc.int/supportnet/application.jsp#support/32" } {
                HTTP::redirect "https://pxl.saas.supportsystems.com/assystnet/application.jsp#services/48"
            }
            else {
                HTTP::redirect $href
            }
        }
    }
    	
    when HTTP_RESPONSE {
        if { ([HTTP::header "Content-Type"] starts_with "text/html") } { 
            STREAM::expression {@</title>@</title>
        <script>
        document.addEventListener(`click`, e => {
          const origin = e.target.closest(`a`);
    
          if (origin && origin.href.indexOf('#') > -1) {
            const base64_href = btoa(origin.href);
            window.location.href = '/f5/anchor_link_redirect?href=' + base64_href;
          }
        });
        </script>@}
            STREAM::enable
        }
    }

    For more info on how to use this iRule see: https://community.f5.com/t5/codeshare/python-script-to-test-if-a-f5-big-ip-is-vulnerable-to-cve-2023/ta-p/323614

    Have fun,

         --Niels