# encoding: utf-8
# copyright: 2017, The Authors

title 'openssh_advisory13'

control 'CVE-2019-6110' do
  impact 0.31
  title 'CVE-2019-6110'
  desc 'OpenSSH could allow a remote attacker to conduct spoofing 
        attacks, caused by accepting and displaying arbitrary stderr output 
        from the scp server. A man-in-the-middle attacker could exploit this 
        vulnerability to spoof scp client output.
  '

  tag 'openssh'
  tag 'aix', 'aix53', 'aix61', 'aix71', 'aix72'
  tag 'vios', 'vios2', 'vios3'
  tag :score, '3.1'
  ref 'http://aix.software.ibm.com/aix/efixes/security/openssh_advisory13.asc'

  only_if do
    os.aix?
  end

  describe command('/usr/bin/lslpp -Lqc openssh.base.client') do
    its('stdout') { should_not match(/:4\.[0-9]\./) }
    its('stdout') { should_not match(/:5\.[0-9]\./) }
    its('stdout') { should_not match(/:6\.[0-9]\./) }
    its('stdout') { should_not match(/:7\.[0-4]\./) }
    its('stdout') { should_not match(/:7\.5\.[0-9]\./) }
    its('stdout') { should_not match(/:7\.5\.[1-9][0-9]\./) }
    its('stdout') { should_not match(/:7\.5\.10[01]\./) }
    its('stdout') { should_not match(/:7\.5\.102\.[0-9]:/) }
    its('stdout') { should_not match(/:7\.5\.102\.[1-9][0-9]:/) }
    its('stdout') { should_not match(/:7\.5\.102\.[1-9][0-9][0-9]:/) }
    its('stdout') { should_not match(/:7\.5\.102\.1[0-5][0-9][0-9]:/) }
    its('stdout') { should_not match(/:7\.5\.102\.1600:/) }
  end

  describe command('/usr/bin/lslpp -Lqc openssh.base.server') do
    its('stdout') { should_not match(/:4\.[0-9]\./) }
    its('stdout') { should_not match(/:5\.[0-9]\./) }
    its('stdout') { should_not match(/:6\.[0-9]\./) }
    its('stdout') { should_not match(/:7\.[0-4]\./) }
    its('stdout') { should_not match(/:7\.5\.[0-9]\./) }
    its('stdout') { should_not match(/:7\.5\.[1-9][0-9]\./) }
    its('stdout') { should_not match(/:7\.5\.10[01]\./) }
    its('stdout') { should_not match(/:7\.5\.102\.[0-9]:/) }
    its('stdout') { should_not match(/:7\.5\.102\.[1-9][0-9]:/) }
    its('stdout') { should_not match(/:7\.5\.102\.[1-9][0-9][0-9]:/) }
    its('stdout') { should_not match(/:7\.5\.102\.1[0-5][0-9][0-9]:/) }
    its('stdout') { should_not match(/:7\.5\.102\.1600:/) }
  end
end
