Follow these steps to set up and run
====================================

1. Extract the Script Archive

    Download WSO2-2024-3561_temporary_mitigation.zip to your preferred location.
    Extract the contents of WSO2-2024-3561_temporary_mitigation.zip.


2. Configure the Script Directory Path

    Set the environment variable SCRIPT to the extracted script directory.
    Replace /path/to/extracted/script with the actual path to the extracted script directory:

    export SCRIPT=/path/to/extracted/script

    eg:
      export SCRIPT=~/Downloads/WSO2-2024-3561_temporary_mitigation


3. Configure the Carbon Home Directory

    Set the environment variable CARBON_HOME to the path of the WSO2 product installation.
    Replace /path/to/wso2 with the actual path to your WSO2 product:

    export CARBON_HOME=/path/to/wso2

    eg:
      export CARBON_HOME=/path/to/wso2is-6.1.0
    eg:
      export CARBON_HOME=/path/to/wso2am-4.2.0


4. Change Directory to the Start Folder

    Navigate to the start folder inside the extracted script directory:

    cd $SCRIPT/start


5. Execute the Script

    Run the start.sh script to execute the setup:

    eg:
      sh start.sh

After running the script, verify that the script has been executed successfully by checking for the confirmation message:
    "Update completed."


Validating the fix
==================

The fix can be validated by sending a SOAP request to UserInformationRecoveryService SOAP service. Following contains a sample cURL command you can use for this purpose. Replace the {username}:{password} with credentials for a non-admin user account, and update the {host} and {port} with the specific values relevant to your deployment.

curl -k -X POST -H "Content-Type: text/xml;charset=UTF-8" \
-H "SOAPAction: \"\"" \
-u {username}:{password} \
-d '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.mgt.identity.carbon.wso2.org">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:getCaptcha/>
   </soapenv:Body>
</soapenv:Envelope>' \
https:/{host}:{port}/services/UserInformationRecoveryService.UserInformationRecoveryServiceHttpsSoap11Endpoint


When the fix is applied properly the response should include "Access Denied". Example response is shown below: 

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault xmlns:axis2ns1="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>axis2ns1:50978</faultcode><faultstring>Access Denied.</faultstring><detail/></soapenv:Fault></soapenv:Body></soapenv:Envelope>


Without the fix the service returns a response that includes "CaptchaInfoBean". Example response is shown below: 

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:getCaptchaResponse xmlns:ns="http://services.mgt.identity.carbon.wso2.org"><ns:return xmlns:ax2300="http://mail.mgt.identity.carbon.wso2.org/xsd" xmlns:ax2304="http://beans.mgt.captcha.carbon.wso2.org/xsd" xmlns:ax2292="http://mgt.identity.carbon.wso2.org/xsd" xmlns:ax2293="http://base.identity.carbon.wso2.org/xsd" xmlns:ax2296="http://dto.mgt.identity.carbon.wso2.org/xsd" xmlns:ax2299="http://beans.mgt.identity.carbon.wso2.org/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax2304:CaptchaInfoBean"><ax2304:imagePath>registry/resource/_system/config/repository/components/org.wso2.carbon.captcha-images/602459f1-d019-4374-b33e-e81d92d6b1a2.jpg</ax2304:imagePath><ax2304:secretKey>602459f1-d019-4374-b33e-e81d92d6b1a2</ax2304:secretKey><ax2304:userAnswer xsi:nil="true"/></ns:return></ns:getCaptchaResponse></soapenv:Body></soapenv:Envelope>
