Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

malware_lodarat_filepath query fails #11

Closed
johnosn opened this issue Apr 6, 2021 · 2 comments
Closed

malware_lodarat_filepath query fails #11

johnosn opened this issue Apr 6, 2021 · 2 comments
Assignees

Comments

@johnosn
Copy link

johnosn commented Apr 6, 2021

malware_lodarat_filepath query fails with the message "near "AND": syntax error"
The query has a ";" character midway in the WHERE clause causing the failure.

A Query like the one below would be able to return results.

SELECT
	f.path,
	f.directory,
	f.filename,
	h.sha256,
	f.uid,
	f.gid,
	f.mode,
	f.size,
	DATETIME(f.atime, "unixepoch","UTC") AS last_access_time,
	DATETIME(f.mtime, "unixepoch", "UTC") AS last_modified,
	DATETIME(f.ctime, "unixepoch", "UTC")  AS last_status_change_time,
	DATETIME(f.btime, "unixepoch", "UTC")  AS creation_time 
FROM file f 
	JOIN hash h ON f.path=h.path  
WHERE 
	f.path LIKE "C:\Users\%\AppData\Roaming\Windata\%.exe"
	AND f.filename LIKE regex_match(f.filename, "([a-zA-Z]{6}|svchost)\.exe", 0);

Or this query

WITH ud AS (
	SELECT directory || '\AppData\Roaming\Windata' AS directory
	FROM users WHERE directory LIKE "%\Users\%")
SELECT
	f.path, f.directory, f.filename, h.sha256, f.uid, f.gid, f.mode, f.size,
	DATETIME(f.atime, "unixepoch", "UTC") AS last_access_time,
	DATETIME(f.mtime, "unixepoch", "UTC") AS last_modified,
	DATETIME(f.ctime, "unixepoch", "UTC") AS last_status_change_time,
	DATETIME(f.btime, "unixepoch", "UTC") AS creation_time,
	f.type
FROM ud
	JOIN file f ON ud.directory = f.directory
	LEFT JOIN hash h ON f.path = h.path 
WHERE
	(f.filename LIKE "%.exe" AND LENGTH(f.filename) = 10)
	OR f.filename = "svchost.exe";
@johnosn
Copy link
Author

johnosn commented Apr 23, 2021

Screenshot showing the location of the extra semi-colon.

malware_lodarat_filepath

@cmarczewski cmarczewski self-assigned this Apr 29, 2021
@cmarczewski
Copy link
Contributor

cmarczewski commented Apr 29, 2021

Resolved via ab19faa.

Thanks for opening this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants