CVE-2018-11319 (Other, published 2018-05-20T20:29Z)
Description: value: Syntastic (aka vim-syntastic) through 3.9.0 does not properly handle searches for configuration files (it searches the current directory up to potentially the root). This improper handling might be exploited for arbitrary code execution via a malicious gcc plugin, if an attacker has write access to a directory that is a parent of the base directory of the project being checked. NOTE: exploitation is more difficult after 3.8.0 because filename prediction may be needed.
Severity: HIGH (CVSS v3 base score: 7.5)
Weakness: CWE-22 \u2014 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
Repository: https://github.com/vim-syntastic/syntastic
Files changed:
autoload/syntastic/c.vim
doc/syntastic-checkers.txt
plugin/syntastic.vim
syntax_checkers/c/avrgcc.vim
syntax_checkers/c/clang_check.vim
syntax_checkers/c/clang_tidy.vim
syntax_checkers/c/cppcheck.vim
syntax_checkers/c/oclint.vim
syntax_checkers/c/pc_lint.vim
syntax_checkers/c/sparse.vim
syntax_checkers/c/splint.vim
syntax_checkers/cpp/verapp.vim
syntax_checkers/cuda/nvcc.vim
Commit message: Security: clear defaults for config file names (cf. #2170).


Vulnerable code:
    let config_file = s:_get_checker_var('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
Default: ".syntastic_ada_config"
Default: ".syntastic_asm_config"
Default: ".syntastic_avrgcc_config"
Default: ".syntastic_clang_check_config"
Default: ".syntastic_clang_tidy_config"
Default: ".syntastic_cppcheck_config"
Default: ".syntastic_c_config"
Default: ".syntastic_oclint_config"
Default: "options.lnt"
Default: ".syntastic_sparse_config"
Default: ".syntastic_splint_config"
Default: ".syntastic_avrgcc_config"
Default: ".syntastic_clang_check_config"
Default: ".syntastic_clang_tidy_config"
Default: ".syntastic_cppcheck_config"
Default: ".syntastic_cpp_config"
Default: ".syntastic_oclint_config"
Default: "options.lnt"
Default: ".syntastic_verapp_config"
Default: ".syntastic_cobol_config"
Default: ".syntastic_cuda_config"
Default: ".syntastic_d_config"
Default: ".syntastic_fortran_config"
Default: ".syntastic_objc_config"
Default: ".syntastic_oclint_config"
Default: ".syntastic_objcpp_config"
Default: ".syntastic_oclint_config"
Default: ".syntastic_verilog_config"
let g:_SYNTASTIC_VERSION = '3.8.0-110'
if !exists('g:syntastic_avrgcc_config_file')
    let g:syntastic_avrgcc_config_file = '.syntastic_avrgcc_config'
endif

        \ 'args_before': syntastic#c#ReadConfig(g:syntastic_avrgcc_config_file),
if !exists('g:syntastic_clang_check_config_file')
    let g:syntastic_clang_check_config_file = '.syntastic_clang_check_config'
endif

        \   syntastic#c#ReadConfig(g:syntastic_clang_check_config_file) . ' ' .
if !exists('g:syntastic_clang_tidy_config_file')
    let g:syntastic_clang_tidy_config_file = '.syntastic_clang_tidy_config'
endif

        \   syntastic#c#ReadConfig(g:syntastic_clang_tidy_config_file) . ' ' .
if !exists('g:syntastic_cppcheck_config_file')
    let g:syntastic_cppcheck_config_file = '.syntastic_cppcheck_config'
endif

        \ 'args': syntastic#c#ReadConfig(g:syntastic_cppcheck_config_file),
if !exists('g:syntastic_oclint_config_file')
    let g:syntastic_oclint_config_file = '.syntastic_oclint_config'
endif

        \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) })
if !exists('g:syntastic_pc_lint_config_file')
    let g:syntastic_pc_lint_config_file = 'options.lnt'
endif

    let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, fnamemodify(bufname(buf), ':p:h'))
if !exists('g:syntastic_sparse_config_file')
    let g:syntastic_sparse_config_file = '.syntastic_sparse_config'
endif

        \ 'args': syntastic#c#ReadConfig(g:syntastic_sparse_config_file),
if !exists('g:syntastic_splint_config_file')
    let g:syntastic_splint_config_file = '.syntastic_splint_config'
endif

        \ 'args': syntastic#c#ReadConfig(g:syntastic_splint_config_file),
if !exists('g:syntastic_verapp_config_file')
    let g:syntastic_verapp_config_file = '.syntastic_verapp_config'
endif

        \ 'args': syntastic#c#ReadConfig(g:syntastic_verapp_config_file),
if !exists('g:syntastic_cuda_config_file')
    let g:syntastic_cuda_config_file = '.syntastic_cuda_config'
endif

        \ 'args': syntastic#c#ReadConfig(g:syntastic_cuda_config_file),

Fixed code:
    let config_file = s:_get_checker_var('b', a:ft, a:ck, 'config_file', s:_get_checker_var('g', a:ft, a:ck, 'config_file', ''))
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
Default: unset
let g:_SYNTASTIC_VERSION = '3.8.0-113'
    let buf = bufnr('')

        \ 'args_before': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'avrgcc_config_file')),
    let buf = bufnr('')

        \   syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'clang_check_config_file')) . ' ' .
    let buf = bufnr('')

        \   syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'clang_tidy_config_file')) . ' ' .
    let buf = bufnr('')

        \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'cppcheck_config_file')),
    let buf = bufnr('')

        \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'oclint_config_file') })
    let config = syntastic#util#findFileInParent(syntastic#util#bufVar(buf, 'pc_lint_config_file'), fnamemodify(bufname(buf), ':p:h'))
    let buf = bufnr('')

        \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'sparse_config_file')),
    let buf = bufnr('')

        \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'splint_config_file')),
    let buf = bufnr('')

        \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'verapp_config_file')),
        \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'cuda_config_file'),