Navigation
  • SEARCH HERE
  • SOLUTIONS
    • Information Security Solutions
      • Enterprise Application Security Solutions in Asia
      • Network & Infrastructure Security Solutions
      • Zero Trust Security
      • Security Information and Event Management
      • Remote Monitoring & Management (RMM)
      • File Integrity Management
      • Systems Administration Tools
      • Data Loss Prevention
      • Data / Password Recovery
      • IT Management Solution Offering | Distributor in Asia
      • Identity and Access Management Solution Offering | Distributor in Asia
      • Employee Activity Monitoring (EAM)
      • Digital Forensic Investigation
    • Software Development Solutions
      • Integrated Development Environments
      • Development Components
        • UI Tools
        • Networking Components
        • Office Components
        • Barcode Components
        • Communication Components
      • Imaging Solutions
      • Software Localization
      • Release Automation & Management
      • eLearning Authoring Solutions
      • Charting Solutions
      • PDF Solutions
      • Reporting Solutions
      • Testing & QA
      • Text Retrieval / Enterprise Search
      • Database
  • Services
    • Live Solution Walkthroughs
    • Implementation Services
    • Best Practices Consulting
    • Pre-Sales and Post-Sales Services
  • What's New
    • Our Event
    • Our Blogs
    • Special Offers
  • About
    • About LOGON Software Asia
    • Our Partnership
  • Publishers - Join our network
  • Resellers - Expand your portfolio
  • Procurement Managers
Site logo
  • Solutions
    • Information Security Solutions
      • Identity and Access Management
        • Privileged Access Management (PAM)
        • Multi-Factor Authentication (MFA)
        • Identification Verification (IV)
        • Self-Service Password Reset (SSPR)
      • Network & Infrastructure Security
        • DDoS Mitigation and Protection
        • Digital Forensic Investigation
        • Malware Detection & Analysis
        • Network Monitoring Software
        • Email Security
        • Log Monitoring
      • Endpoint & Device Security
        • Patch Management
        • Remote Monitoring & Management (RMM)
        • Employee Activity Monitoring (EAM)
        • Mobile Device Management (MDM)
      • IT Management
        • IT Service Management
        • IT Asset Management
        • Software Asset Management
        • Hardware Asset Management
        • Software License Management
        • Systems Administration Tools
      • Application Security
        • Development Security | Shift Left AppSec | SAST, SCA, IAST
        • Runtime Protection Solutions | DAST, RASP, WAF, Container Security
        • Strategic Management Solutions | ASPM, MAST, VAPT
      • Data Security
        • Data / Password Recovery
        • File Integrity Management
        • Data Loss Prevention
      • Cloud Security
        • Cloud Security Posture Management
        • Cloud Work Protection
      • External Attack Surface Management
        • Cyber Threat Intelligence
        • Third Party Risk Management
      • Security Operations & Incident Management
        • Security Information and Event Management
        • Security Orchestration, Automation and Response (SOAR)
      • Zero Trust Security
    • Software Development Solutions
      • Integrated Development Environments
      • Imaging Solutions
      • UI Tools
      • Charting Solutions
      • Developer Tools
      • Database
      • Networking Components
      • Office Components
      • Barcode Components
      • Release Automation & Management
      • Software Localization
      • Communication Components
      • Automated Testing
      • eLearning Authoring Solutions
      • Reporting Solutions
      • Text Retrieval / Enterprise Search
      • Testing & QA
  • Services
        • Live Walkthrough Sessions

          Experience the full feature of our key solutions through live platform

          View All Sessions >
        • Implementation Services
        • Pre-Sales and Post-Sales Services
        • Best Practices Consulting
  • Partners
    • Our Partners
    • Partner with LOGON Today!
      • Vendors - Join Our Network
      • Resellers - Expand Your Portfolio
      • Procurement Managers
  • Resources
        • ABOUT US

        • About Us
        • Our Locations
        • Careers@LOGON - We are hiring !
        • DISCOVER

        • Our BlogsNEW BLOGS
        • Our EventsJOIN UPCOMING EVENTS
        • LOGON to CyberSecurity PodcastNEW EPISODES
        • GET HELP

        • Contact Us
        • Help Desk
        • Request a Demo
        • Request a Quote
        • COMPLIANCE

        • 🇭🇰 Hong Kong PDPO
        • 🇮🇳 India DPDP Act
        • 🇸🇬 Singapore PDPA
        • 🇹🇭 Thailand PDPA
  • More results...

Scanning a SOAP Web Service for Vulnerabilities

APIs and web services may seem less popular than websites and web applications but that is not true. Already back in 2018, APIs were responsible for 83% of web traffic worldwide. Most complex applications are based on microservices and microservices are basically web applications communicating with one another using APIs. Web services and APIs are prone to the same vulnerabilities as web applications. Therefore, to keep them secure, you need to know how to scan them.

Stage 1: Build a Simple Web Service

In this part, you will learn how to:

  1. Create a database on your web server to store your data

  2. Build a /var/www/hello/config.php file to store the parameters to connect to the database

  3. Build a /var/www/hello/functions.php file for the basic support functions for the service to work

  4. Build a /var/www/hello/hello_server.php file for the API functions that the web service will provide; in this example we will provide a single API function called doGetUserName

  5. Build a /var/www/hello/hello_client.php file that will present an input form to the user and use the web service to retrieve the requested information

  6. Build a /var/www/hello/hello.wsdl to describe the web service

Step 1. Create a Database on Your Web Server

Run the following commands from the MariaDB or MySQL root prompt:

MariaDB [(none)]> create user 'hellouser'@'localhost' identified by 'hellouserpass';
MariaDB [(none)]> create database hellodb;
MariaDB [hellodb]> GRANT ALL PRIVILEGES ON hellodb.* TO 'hellouser'@'localhost';
MariaDB [(none)]> use hellodb;
MariaDB [hellodb]> CREATE TABLE `users` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(30) DEFAULT NULL, `email` varchar(30) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UNIQUE_email` (`email`) );
MariaDB [hellodb]> INSERT INTO users (name, email) VALUES ('John Doe', '[email protected]');
MariaDB [hellodb]> INSERT INTO users (name, email) VALUES ('Jane Doe', '[email protected]');

Step 2. Build Your Config File

Using nano, create a /var/www/hello/config.php file as follows:

<?php
$db_host = 'localhost';
$db_name = 'hellodb';
$db_user = 'hellouser';
$db_pass = 'hellouserpass';

Step 3. Build Your Functions File

Using nano, create a /var/www/hello/functions.php file as follows:

<?php
include 'config.php';

function function_response($response_string) : int {
    $response_value = intval(substr($response_string,0,3));
  return $response_value;
}

function function_payload($response_string) : string {
    $response_value = substr($response_string,4);
    return $response_value;
}

function user_get_name($useremail) : string {
    global $db_host, $db_user, $db_pass, $db_name;
    try{
        $db_conn = new PDO('mysql:host='.$db_host.';dbname='.$db_name, $db_user, $db_pass);
        $db_qry = "SELECT count(name) FROM users WHERE email = '" . $useremail ."'";
        $db_act = $db_conn->prepare($db_qry);
        $db_act->execute();
        $db_rows = $db_act->fetchColumn();
        if ($db_rows>0) {
            $retval="";
            $db_qry = "SELECT name FROM users WHERE email = '" . $useremail . "'";
            $db_act = $db_conn->prepare($db_qry);
            $db_act->execute();
            $rows = $db_act->fetchAll(PDO::FETCH_ASSOC);
            foreach ($rows as $row) {
                if ($retval=="") {
                    $retval = $row['name'];
                } else {
                    $retval = $retval . ", " . $row['name'];
                }
            }
            $db_conn = null;
            return "200 " . $retval;
        } else {
            $db_conn = null;
            return "404 Not Found";
        }
    }
    catch(PDOException $e) {
        error_log('PDOException - ' . $e->getMessage(),0);
        $db_conn->close();
        return "500 Database Unavailable";
    }
}

Step 4. Build Your Web Service Server File

Using nano, create a /var/www/hello/hello_server.php file as follows:

<?php
include 'config.php';
require_once 'functions.php';

if(!extension_loaded("soap")){
    dl("php_soap.dll");
}

ini_set("soap.wsdl_cache_enabled","0");
$server = new SoapServer("hello.wsdl");

function doGetUserName($emailaddr){
    return function_payload(user_get_name($emailaddr));
}

$server->addFunction("doGetUserName");
$server->handle();
?>

Step 5. Build Your Web Application User Interface

Using nano, create a /var/www/hello/hello_client.php file as follows:

<?php
include 'config.php';
require_once 'functions.php';

$emailaddr = $_POST["useremail"];

if (!empty($emailaddr)) {
    try{
        $sClient = new SoapClient('https://siptesting.net/hello/hello.wsdl');
        $response = $sClient->doGetUserName($emailaddr);
        echo "<h1>This is the Full Name of the user registered with email address: ".$emailaddr.":</h1><br>";
        echo $response;        
    } catch(SoapFault $e){
        var_dump($e);
    }
} else {
    echo "<form action=\"/hello/hello_client.php\" method=\"post\">";
    echo "Enter User Email to search for: <input type=\"text\" name=\"useremail\"><br>";
    echo "<input type=\"submit\">";
    echo "</form>";
    echo "<br><br><a href=\"/\">Home Page</a>";
}
?>

Step 6. Create Your Web Service Definition File

Using nano, create a /var/www/hello/hello.wsdl file as follows:

<?xml version="1.0"?>
<definitions name="HelloWorld" targetNamespace='urn:HelloWorld' xmlns:tns="urn:HelloWorld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Hello">
      <xsd:element name="getUserName" type="xsd:string" />
      <xsd:element name="getUserNameResponse" type="xsd:string" />      
  </xsd:schema>     
  </types>
  
  <message name="doGetUserName">
    <part name="emailAddress" type="tns:getUserName" />
  </message>

  <message name="doGetUserNameResponse">
    <part name="return" type="tns:getUserNameResponse" />
  </message>

  <portType name="HelloPort">
    <operation name="doGetUserName">
      <input message="tns:doGetUserName" />
      <output message="tns:doGetUserNameResponse" />
    </operation> 
  </portType>
  
  <binding name="HelloBinding" type="tns:HelloPort">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    <operation name="doGetUserName">
      <soap:operation soapAction="urn:GetUserNameAction" />
      <input>
        <soap:body use="encoded" namespace="urn:Hello" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />     
      </input>
      <output>
        <soap:body use="encoded" namespace="urn:Hello" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />     
      </output>
    </operation>
  </binding>
  
  <service name="HelloService">
    <port name="HelloPort" binding="tns:HelloBinding">
    <soap:address location="https://siptesting.net/hello/hello_server.php" />
  </port>
  </service>
    
</definitions>

Stage 2. Scan Your Web Service

In this example, our web service is defined at https://siptesting.net/hello/hello.wsdl. To scan the web service with Acunetix:

  1. Create a new target with URL https://siptesting.net/hello/hello.wsdl

  2. Deploy the PHP AcuSensor to your web service

  3. Launch a full scan against your web service and wait for it to complete

Stage 3. Identify Vulnerabilities in Your Web Service

Examine the list of vulnerabilities for your target

We shall concentrate on the cross-site scripting and SQL injection vulnerabilities for this exercise.

Item 1. Cross-site Scripting

  1. Acunetix shows the attack details – the input field was populated with a potentially malicious script.

  2. Acunetix highlights the exploit script code in the HTTP Response section. This means that the data inserted into the the input field is not being validated correctly.

Item 2. SQL Injection

  1. Acunetix shows the attack details — the input field was populated with potentially malicious data crafted in a way to coerce the database to show data that was not intended to be shown, allowing a malicious hacker to craft additional requests to possibly retrieve large volumes of data.

  2. Acunetix highlights the exploit data in the HTTP Response section — it was able to retrieve names of multiple users. This means that the data inserted into the the input field is not being validated correctly.

Stage 4. Resolve the Vulnerabilities

Item 1. Cross-site Scripting

The root cause for this vulnerability lies inside this line inside the hello_client.php file:

echo "<h1>This is the Full Name of the user registered with email address: ".$emailaddr.":</h1><br>";

The $emailaddr contains the unvalidated content of the user input field and this is being sent back to the browser, which means that the browser can be coerced to execute script code. We need to sanitize the contents of this variable before sending it to the browser, adjusting the code as follows:

echo "<h1>This is the Full Name of the user registered with email address: ".htmlspecialchars($emailaddr).":</h1><br>";

Item 2. SQL Injection

A quick look at the hello_server.php file can reveal the root cause. The queries are built using string concatenation:

$db_qry = "SELECT count(name) FROM users WHERE email = '" . $useremail ."'";
$db_act = $db_conn->prepare($db_qry);
$db_act->execute();
$db_qry = "SELECT name FROM users WHERE email = '" . $useremail . "'";
$db_act = $db_conn->prepare($db_qry);
$db_act->execute();

The $emailaddr variable is being simply concatenated to the query string without any validation. We need to adjust the code by parameterising the query string, ensuring that any parameters passed are correctly escaped and quote-encapsulated, disallowing further exploits. The new code snippets would look like this:

$db_qry = "SELECT count(name) FROM users WHERE email = :useremail";
$db_act = $db_conn->prepare($db_qry);
$db_act->bindParam(':useremail', $useremail);
$db_act->execute();
$db_qry = "SELECT name FROM users WHERE email = :useremail";
$db_act = $db_conn->prepare($db_qry);
$db_act->bindParam(':useremail', $useremail);
$db_act->execute();

Stage 5. Rescan to Confirm Resolution

We can go to the list of vulnerabilities for the scan and select the vulnerabilities we have adjusted.

Now click on the Retest button — this will create a new scan to test the selected vulnerabilities again. The results will show that we have successfully resolved the vulnerabilities.

Back to Acunetix Page

Privacy Policy Company Overview

COMPANY

Our Location Career with LOGON Our Partners

SERVICES

Training Services Implementation Services Pre-Sales and Post-Sales Services Best Practices Consulting

GET IN TOUCH

Phone:
Hong Kong: +852 2512 8491
India: +91 70220 22744 / +91 63668 26133
Email: [email protected] ©2025 LOGON International Ltd. All rights reserved
logon logo WHITE

Search engine

Use this form to find things you need on this site

More results...

Fill in the form below
  • This field is for validation purposes and should be left unchanged.
  • This field is hidden when viewing the form
  • This field is hidden when viewing the form

Watch On-demand Webinar

  • This field is for validation purposes and should be left unchanged.

Get Your Free UserLock Trial

  • This field is for validation purposes and should be left unchanged.

Download Your Free Trial 10-Day Trial Today

  • Downloading and evaluating Smart Package Studio is quick and easy
  • Includes a short introductory guide that suggests smart features to try
  • Access the full functionality of Smart Package Studio during the trial
  • This field is for validation purposes and should be left unchanged.

Request for Priority Support with our support team

  • This field is for validation purposes and should be left unchanged.
  • Drop files here or
    Max. file size: 30 MB.

    Get Free Assessment of your Web Asset

    Request a free non-intrusive security assessment of your website. Get a report with an overview of client-side security risks.

    • This field is for validation purposes and should be left unchanged.
    • This field is hidden when viewing the form

    Recommend a Topic

    • This field is for validation purposes and should be left unchanged.

    Partner with Us on the next episode

    • This field is for validation purposes and should be left unchanged.

    Request Quote for Lansweeper

    Oops! We could not locate your form.

    Watch On-demand Webinar

    • This field is for validation purposes and should be left unchanged.
    Start PreCrime Network for Free

    Oops! We could not locate your form.

    Book a Free Demo Today

    Get Your Free Trial

    Oops! We could not locate your form.

    Get Your Free Trial
    • This field is for validation purposes and should be left unchanged.
    • This field is hidden when viewing the form
    • This field is hidden when viewing the form
    Request for Training Quote

    Oops! We could not locate your form.

    Request for Training Quote

    Oops! We could not locate your form.

    Request for Training Quote

    Oops! We could not locate your form.

    Request for Training Quote
    • This field is for validation purposes and should be left unchanged.
    • Please enter a number from 1 to 20.
    • This field is hidden when viewing the form
    Request for Training Quote
    • This field is for validation purposes and should be left unchanged.
    • Please enter a number from 1 to 20.
    • This field is hidden when viewing the form
    Request for Training Quote
    • Please enter a number from 1 to 20.
    • DD slash MM slash YYYY
    Request for Training Quote
    • This field is for validation purposes and should be left unchanged.
    • Please enter a number from 1 to 20.
    • DD slash MM slash YYYY
    Request for Training Quote
    • This field is for validation purposes and should be left unchanged.
    • Please enter a number from 1 to 20.
    • DD slash MM slash YYYY
    Request for Training Quote
    • This field is for validation purposes and should be left unchanged.
    • Please enter a number from 1 to 20.
    • This field is hidden when viewing the form