1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

事象 : VisualStudioCodeを使ってWSL2でマークダウンファイルを見ていたらエラーが出た

  • 環境
    • OS : Windows10 バージョン22H2
    • Windows Subsystem for Linux : バージョン2
    • VisualStudioCode : バージョン1.18.0
[Error - 10:15:43 AM] Markdown Language Server client: couldn't create connection to server.
Error: UNC host 'wsl$' access is not allowed
    at lstat (node:fs:1489:10)
    at Object.t.lstat (node:electron/js2c/asar_bundle:2:4065)
    at c:\apps\Microsoft VS Code\resources\app\extensions\markdown-language-features\dist\extension.js:2:852555
    at new Promise (<anonymous>)
    at b._getServerWorkingDir (c:\apps\Microsoft VS Code\resources\app\extensions\markdown-language-features\dist\extension.js:2:852536)
    at b.createMessageTransports (c:\apps\Microsoft VS Code\resources\app\extensions\markdown-language-features\dist\extension.js:2:846765)
    at b.createConnection (c:\apps\Microsoft VS Code\resources\app\extensions\markdown-language-features\dist\extension.js:2:688475)
    at b.start (c:\apps\Microsoft VS Code\resources\app\extensions\markdown-language-features\dist\extension.js:2:679450)
    at t.$Bk (c:\apps\Microsoft VS Code\resources\app\extensions\markdown-language-features\dist\extension.js:2:957697)
    at c:\apps\Microsoft VS Code\resources\app\extensions\markdown-language-features\dist\extension.js:2:2079465
    at e.activate (c:\apps\Microsoft VS Code\resources\app\extensions\markdown-language-features\dist\extension.js:2:2079510)
    at Function.eb (c:\apps\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:113:13743)
    at Function.db (c:\apps\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:113:13456)
    at c:\apps\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:113:11577
    at w.n (c:\apps\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:99:6194)
    at w.m (c:\apps\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:99:6157)
    at w.l (c:\apps\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:99:5614)

原因 : 許可していないUNCパスには繋げないから

Visual Studio Codeに脆弱性がありました。

Visual Studio Code の情報漏えいの脆弱性
...省略...
この脆弱性が悪用されると、NTLM ハッシュが漏えいする可能性があります。
Security Update Guide - Microsoft Security Response Center

その脆弱性を「バージョン1.78.1」で修正したことにより許可していない「UNCパス」にはアクセスできないようになりました。

VS Code Information Disclosure Vulnerability
A information disclosure vulnerability exists in VS Code 1.78.0 and earlier versions on Windows when file system operations are performed on malicious UNC paths. Examples include reading or resolving metadata of such paths. An authorised attacker must send the user a malicious file and convince the user to open it for the vulnerability to occur. Exploiting this vulnerability could allow the disclosure of NTLM hashes.
Information Disclosure Vulnerability · Advisory · microsoft/vscode

「UNCパス」は、ネットワーク上でのディレクトリやらプリンターやらのリソースへのパスなので「WSL」も対象になります。

UNCとは、Windowsネットワーク上で共有されている様々な資源(ファイルやフォルダ、プリンタなど)の位置を表記する標準的な記法。
UNCとは - 意味をわかりやすく - IT用語辞典 e-Words

対応 : 許可対象を設定する

  1. VisualStudioCodeの[Settings]を開く
  2. [Security] > [Allowed UNCHosts] > [Add Item]ボタン押下
  3. 「wsl$」を入力 > [OK]ボタンで追加する
  4. VisualStudioCodeを再起動
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?