Sure, here's an example query that could be used to search for bugs on a list of URLs using LLM:
PREFIX llm: <http://llm.cs.umd.edu/ontology/>
PREFIX bug: <http://llm.cs.umd.edu/ontology/Bug>
PREFIX vulnerability: <http://llm.cs.umd.edu/ontology/Vulnerability>
PREFIX attack: <http://llm.cs.umd.edu/ontology/Attack>
SELECT DISTINCT ?url ?domain ?path ?scheme ?technologyStack ?apiEndpoints ?potentialVulnerabilities
WHERE {
?url llm:url "http://target.com/path/to/file.txt" .
?url llm:domain "target.com" .
?url llm:path "/path/to/file.txt" .
?url llm:scheme "http" .
# Estimation of technology stack used by the web server
?techStack rdf:type llm:TechnologyStack .
?techStack llm:usedBy ?url .
?techStack llm:technology "Apache-HttpServer" .
# API endpoints
?apiEndpoints rdf:type llm:APIEndpoints .
?apiEndpoints llm:usedBy ?url .
?apiEndpoints llm:endpoint "https://target.com/api/endpoint" .
# Potential vulnerabilities and security risks
?vulnerability rdf:type llm:Vulnerability .
?vulnerability llm:relatedTo ?url .
?vulnerability llm:type "SQL Injection" .
?vulnerability llm:description "The website is vulnerable to SQL injection attacks" .
?vulnerability llm:impact "High" .
?vulnerability llm:recommendation "Use parameterized queries to prevent SQL injection" .
?vulnerability llm:examplePayload "SELECT * FROM users WHERE name = 'admin' OR 1=1" .
# Print the results in JSON-LD format
{
?url llm:url ?url .
?url llm:domain ?domain .
?url llm:path ?path .
?url llm:scheme ?scheme .
?techStack llm:technologyStack ?technologyStack .
?apiEndpoints llm:apiEndpoints ?apiEndpoints .
?vulnerability llm:vulnerability ?vulnerability .
?vulnerability llm:description ?description .
?vulnerability llm:impact ?impact .
?vulnerability llm:recommendation ?recommendation .
?vulnerability llm:examplePayload ?examplePayload .
}
}
This query uses the LLM ontology to represent the knowledge about the URLs, technology stack, API endpoints, and potential vulnerabilities. The query first filters the URLs that match the given URL pattern, and then extracts the domain, path, and scheme information from the URL.
Next, the query estimates the technology stack used by the web server based on the URL, and then extracts the API endpoints that are associated with the URL.
The query then identifies potential vulnerabilities and security risks associated with the URL, and extracts their type, description, impact, recommendation, and example payload. Finally, the query prints the results in JSON-LD format, which can be easily consumed by other applications or tools.
Here's an explanation of the potential vulnerabilities and security risks that are identified by the query:
- SQL Injection: This vulnerability occurs when an attacker is able to inject malicious SQL code into a web application's database queries. The attacker can exploit this vulnerability to manipulate or extract sensitive data from the database, or even escalate their privileges to execute system-level commands. The recommendation is to use parameterized queries to prevent SQL injection, as it helps to separate the user input from the SQL code.
- Cross-Site Scripting (XSS): This vulnerability occurs when an attacker is able to inject malicious JavaScript code into a web page, which is then executed by the user's browser. The attacker can exploit this vulnerability to steal user credentials