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

Avoid giving an error when one of the file permissions cannot be extracted #2940

Merged
merged 2 commits into from Mar 28, 2019

Conversation

crolopez
Copy link
Contributor

@crolopez crolopez commented Mar 27, 2019

When a file has permissions for an account whose name is unknown, this error appeared:

ossec-agent: ERROR: It was not possible to extract the permissions of 'c:\file_path'. Error: -3.

imagen

Since 463857e, if the permission of a file cannot be extracted, it ignores it and shows the rest of the permissions.

{
    "syscheck":{
        "path":"c:\\windows\\sysnative\\drivers\\wd\\wdboot.sys",
        "size_after":"46680",
        "win_perm_after":[
            {
                "name":"ALL APPLICATION PACKAGES",
                "allowed":[
                    "READ_CONTROL",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_READ_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES"
                ]
            },
            {
                "name":"Users",
                "allowed":[
                    "READ_CONTROL",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_READ_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES"
                ]
            },
            {
                "name":"TrustedInstaller",
                "allowed":[
                    "DELETE",
                    "READ_CONTROL",
                    "WRITE_DAC",
                    "WRITE_OWNER",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_WRITE_DATA",
                    "FILE_APPEND_DATA",
                    "FILE_READ_EA",
                    "FILE_WRITE_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES",
                    "FILE_WRITE_ATTRIBUTES"
                ]
            },
            {
                "name":"SYSTEM",
                "allowed":[
                    "DELETE",
                    "READ_CONTROL",
                    "WRITE_DAC",
                    "WRITE_OWNER",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_WRITE_DATA",
                    "FILE_APPEND_DATA",
                    "FILE_READ_EA",
                    "FILE_WRITE_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES",
                    "FILE_WRITE_ATTRIBUTES"
                ]
            },
            {
                "name":"Administrators",
                "allowed":[
                    "DELETE",
                    "READ_CONTROL",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_WRITE_DATA",
                    "FILE_APPEND_DATA",
                    "FILE_READ_EA",
                    "FILE_WRITE_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES",
                    "FILE_WRITE_ATTRIBUTES"
                ]
            }
        ],
        "uid_after":"S-1-5-18",
        "md5_after":"e7e16778c8440bb459c94b5ad8282491",
        "sha1_after":"263274388b2e3f9adbcdf42b8eaadbb8cb5689b6",
        "sha256_after":"728b2208884b4244e3481ddd82f9b353fc27dac77488dbc8224ab1630616676a",
        "attrs_after":[
            "ARCHIVE"
        ],
        "uname_after":"SYSTEM",
        "mtime_after":"2018-12-12T09:36:00",
        "event":"added"
    }
}

Since 92e3c99, for this type of permissions the SID of the applied account will be shown.

{
    "syscheck":{
        "path":"c:\\windows\\sysnative\\drivers\\wd\\wdboot.sys",
        "size_after":"46680",
        "win_perm_after":[
            {
                "name":"ALL APPLICATION PACKAGES",
                "allowed":[
                    "READ_CONTROL",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_READ_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES"
                ]
            },
            {
                "name":"S-1-15-3-1024-3153509613-960666767-3724611135-2725662640-12138253-543910227-1950414635-4190290187",
                "allowed":[
                    "READ_CONTROL",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_READ_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES"
                ]
            },
            {
                "name":"Users",
                "allowed":[
                    "READ_CONTROL",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_READ_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES"
                ]
            },
            {
                "name":"TrustedInstaller",
                "allowed":[
                    "DELETE",
                    "READ_CONTROL",
                    "WRITE_DAC",
                    "WRITE_OWNER",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_WRITE_DATA",
                    "FILE_APPEND_DATA",
                    "FILE_READ_EA",
                    "FILE_WRITE_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES",
                    "FILE_WRITE_ATTRIBUTES"
                ]
            },
            {
                "name":"SYSTEM",
                "allowed":[
                    "DELETE",
                    "READ_CONTROL",
                    "WRITE_DAC",
                    "WRITE_OWNER",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_WRITE_DATA",
                    "FILE_APPEND_DATA",
                    "FILE_READ_EA",
                    "FILE_WRITE_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES",
                    "FILE_WRITE_ATTRIBUTES"
                ]
            },
            {
                "name":"Administrators",
                "allowed":[
                    "DELETE",
                    "READ_CONTROL",
                    "SYNCHRONIZE",
                    "FILE_READ_DATA",
                    "FILE_WRITE_DATA",
                    "FILE_APPEND_DATA",
                    "FILE_READ_EA",
                    "FILE_WRITE_EA",
                    "FILE_EXECUTE",
                    "FILE_READ_ATTRIBUTES",
                    "FILE_WRITE_ATTRIBUTES"
                ]
            }
        ],
        "uid_after":"S-1-5-18",
        "md5_after":"e7e16778c8440bb459c94b5ad8282491",
        "sha1_after":"263274388b2e3f9adbcdf42b8eaadbb8cb5689b6",
        "sha256_after":"728b2208884b4244e3481ddd82f9b353fc27dac77488dbc8224ab1630616676a",
        "attrs_after":[
            "ARCHIVE"
        ],
        "uname_after":"SYSTEM",
        "mtime_after":"2018-12-12T09:36:00",
        "event":"added"
    }
}

It affects Wazuh 3.8.X.

@crolopez crolopez added module/fim File Integrity Monitoring platform/windows labels Mar 27, 2019
@crolopez crolopez added this to Needs review in Wazuh 3.9.0 via automation Mar 27, 2019
@albertomn86 albertomn86 modified the milestone: 13th week sprint Mar 27, 2019
@albertomn86 albertomn86 removed this from Needs review in Wazuh 3.9.0 Mar 28, 2019
@albertomn86 albertomn86 merged commit f2a2d97 into 3.9 Mar 28, 2019
@albertomn86 albertomn86 deleted the fix-winperm-extr branch March 28, 2019 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/fim File Integrity Monitoring platform/windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants