split PS wrapper and payload (CVE-2018-16859) (#49142)

* prevent scriptblock logging from logging payload contents
* added tests to verify no payload contents in PS Operational event log
* fix script action to send split-aware wrapper
* fix CLIXML error parser (return to -EncodedCommand exposed problems with it)
This commit is contained in:
Matt Davis
2018-11-26 15:28:21 -08:00
committed by GitHub
parent e7104a445b
commit 8c1f701e6e
12 changed files with 91 additions and 30 deletions

View File

@@ -1,4 +1,8 @@
---
- name: fetch current target date/time for log filtering
raw: '[datetime]::now | Out-String'
register: test_starttime
- name: test normal module execution
test_fail:
register: normal
@@ -180,7 +184,7 @@
- set_fact:
become_test_username: ansible_become_test
gen_pw: password123! + {{ lookup('password', '/dev/null chars=ascii_letters,digits length=8') }}
gen_pw: "{{ 'password123!' + lookup('password', '/dev/null chars=ascii_letters,digits length=8') }}"
- name: create unprivileged user
win_user:
@@ -248,3 +252,15 @@
that:
- not common_functions_res is failed
- common_functions_res.msg == "good"
- name: get PS events containing module args or envvars created since test start
raw: |
$dt=[datetime]"{{ test_starttime.stdout|trim }}"
(Get-WinEvent -LogName Microsoft-Windows-Powershell/Operational |
? { $_.TimeCreated -ge $dt -and $_.Message -match "test_fail|fail_module|hyphen-var" }).Count
register: ps_log_count
- name: assert no PS events contain module args or envvars
assert:
that:
- ps_log_count.stdout | int == 0