Skip to content

IIS log parser (iis.py) ignores valid IIS log entries containing characters outside the "URI Safe characters" list - potential fix included #5029

Description

@J-A-Sec

Describe the problem:

I attempted to create a timeline from IIS logs containing web app exploitation attempts, including SQL injection. The log file was ~36,000 lines, but Plaso only parsed ~8,000 lines.

To Reproduce:

The version of Plaso you used:

20250918

The operating system you are running Plaso on:

Ubuntu 24.04

Steps to reproduce the behavior including command line and arguments and output:

Run the command line below against the IIS log file:
log2timeline --storage-file /path/to/storagefile.plaso /path/to/inputfile

Please provide the source data you used when you experienced the problem. For publicly available data please provide a URL or path of the source data.

I cannot provide the entire source file, but here are some sample lines that have been anonymised:

2026-01-17 04:35:51 10.0.0.1 GET /~login - 443 - 12.34.56.78 curl/7.54.0 - 302 0 0 41
2026-01-17 19:22:16 10.0.0.1 GET /Page%'+AND+2*3*8=6*8+AND+'oLjH'!='oLjH%/CookiePolicy - 443 - 12.34.56.78 User-Agent:+Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+360SE) https://webapp.example.com 302 0 0 109
2026-01-17 19:22:08 10.0.0.1 GET /(select+198766*667891)/plugins/ckeditor/ckeditor.js - 443 - 12.34.56.78 User-Agent:+Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+360SE) - 302 0 0 118
2026-01-17 19:22:15 10.0.0.1 GET /Page'+AND+2*3*8=6*8+AND+'kH4r'='kH4r/CookiePolicy - 443 - 12.34.56.78 User-Agent:+Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+360SE) https://webapp.example.com 302 0 0 109
2026-01-17 19:22:45 10.0.0.1 GET /bundles0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z/cookieConsent.js - 443 - 12.34.56.78 User-Agent:+Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+360SE) https://webapp.example.com 302 0 0 107

The method you used to install Plaso:

Installed from [GiFT PPA][https://launchpad.net/~gift] stable track

Expected behavior:

It is expected that all log entries are parsed, no matter which characters are in the URI fields.

Debug output/tracebacks:

Example 19 of 488 extraction warnings:
**************************** Extraction warning: 19 **************************** Message : unable to parse log line: 5409 "2026-01-17 19:22:16 10.0.0.1 GET /Page%'+AND+2*3*8=6*8+AND+'oLjH'!='oLjH%/..." Parser chain : text/winiis Path specification : type: OS, location: /path/to/inputfile.log

Additional context

Based on the local fix below, the issue appears to be that the "URI safe characters" defined in iis.py are not inclusive enough of the characters that IIS will accept (or at the very least, record in the log). Similar to the issue here: #1961

I was able to get Plaso to parse all ~36,000 IIS log lines by adding characters to the definitions of _URI, _URI_STEM and _QUERY in the iis.py parser:

{}|\^~[]`'"<>@$*!

The asterisk and exclamation mark were additions to the extra characters already defined in _QUERY.

How this looks in the code:

# Username can consist of: "domain.username", "domain\username",
  # "domain\user$", "domain/user", "user@domain" or "-" for an anonymous user.
  _USERNAME = pyparsing.Word(pyparsing.alphanums + '-.\\$@/') | _BLANK

  _URI_SAFE_CHARACTERS = '/.?&+;_=()-:,%'

  _URI = pyparsing.Word(pyparsing.alphanums + _URI_SAFE_CHARACTERS + '{}|\\^~[]`\'"<>@$*!') | _BLANK

  _URI_STEM = (pyparsing.Word(
      pyparsing.alphanums + _URI_SAFE_CHARACTERS + '{}|\\^~[]`\'"<>@$*!') | _BLANK)

  _UA = pyparsing.Word(
      pyparsing.alphanums + _URI_SAFE_CHARACTERS + '[]') | _BLANK

  _COOKIE = pyparsing.Word(
      pyparsing.alphanums + _URI_SAFE_CHARACTERS + '@{}"\\') | _BLANK

  # Per https://blogs.iis.net/nazim/use-of-special-characters-like-in-an-iis-url
  # IIS does not require that a query comply with RFC1738 restrictions on valid
  # URI characters
  _QUERY = (pyparsing.Word(
      pyparsing.alphanums + _URI_SAFE_CHARACTERS + '{}|\\^~[]`\'"<>@$*!') |
           _BLANK)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions