.

[C#] Adobe Flash Player 자동 업데이트 문제와 해결

by 담배맛구마

어.도.비.매.우.극.혐.뻐.킹.

취약점이 정말 자주 나와서 업데이트를 정말많이한다. 현재 29.0.0.171 나왔는데... 곧 30이 나올것 같다.

다수의 단말기들을 업데이트를 진행해야 하기에 수많은 삽질을 여기다가 기록한다.

 


 

거두절미하고 추구해야할 방향은 닥치고 어도비 플래시 플레이어 자동업데이트를 걸어 놓는것이다. 하지만, 다양한 사유(그냥 사용자가 끄는거 밖에 없겠지만)에 의해 자동업데이트가 풀리니 문제이다.

 

일반적으로 어도비 플래시 플레이어 자동업데이트가 진행이 안되는 시나리오는 다음과 같다.

1. 어도비 플래시 플레이어 설치시, 물어보니까 그때 걍 해제한다.
2. 윈도우 시작시, 업데이트 체크해서 업데이트를 알려줄때 그냥 씹고 무시한다.
3. 제어판에서 Flash Player를 통해 업데이트 기능 해제한다.
4. 어도비 플래시 플레이어 업데이트 관련 서비스, 예약작업에서 중지 혹은 제거한다.
5. 변태적이게도 mms.cfg 파일을 수작업으로 수정해서 업데이트를 해제한다.
6. 전혀 생각도 못한 이상한 방법으로 설정을 바꾼다.

 

아무튼 정말 다양한 방법으로 어도비 플래시 플레이어 자동업데이트를 해제할(될) 수 있다. 이에 대한 솔루션을 찾던 도중 어도비 플레시 플레이어 관리자 매뉴얼을 보면 mms.cfg를 수정하면된다고 나와있다.

 

mms.cfg의 경로는 다음과 같다.

Windows 32bit : C:\Windows\System32\Macromed\Flash\mms.cfg
Windows 64bit : C:\Windows\SysWOW64\Macromed\Flash\mms.cfg
Macintosh: /Library/Application Support

 

그리고 자동 업데이트를 하려면 mms.cfg를 다음과 같이 수정하면된다. (관리자 권한이 필요하다)

AutoUpdateDisable=0
SilentAutoUpdateEnable=1

 

UTF-8이다 조심할수있도록 한다!!! 인코딩 잘못되면 인식못한다. AutoUpdateDisable=0은 자동 업데이트를 하겠다는것이고 SilentAutoUpdateEnable=1는 업데이트를 백그라운드로 설치하겠다는 내용이다.

 

이렇게 수정해서 적용을 시켰더니 아무반응이 없었다. 원인는 관련된 서비스, 예약작업이 없기 때문이다. 정상적인 접근으로 제어판에서 Flash Player를 통해 자동 업데이트 설정하면 관련된 서비스, 예약작업이 생기지만... 수작업으로 mms.cfg를 수정하면 그렇지 아니하다.

 


 

그래서 결론은 다수의 단말기에 어도비 플래시 플레이어 업데이트를 위해서는 mms.cfg를 수정하고나서 관련된 서비스와 예약작업을 만들어야 제대로 작동한다는 것이다. 이를 처리하려고 처음으로 C#을 대충짜서 시도했더니 잘 작동한다.

Adobe Flash Player Update.cs
다운로드

using System;
using System.Linq;
using System.ServiceProcess;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace AdobeFlashPlayerSetting{
    class Program{
        static void Main(string[] args){
            debugConsole("=======================");
            debugConsole("[1] Check mms.cfg file.");
            string arch = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE").Contains("64") ? "win64" : "win32";
            string text = (arch == "win64") ? System.IO.File.ReadAllText(@"C:\Windows\SysWOW64\Macromed\Flash\mms.cfg") : System.IO.File.ReadAllText(@"C:\Windows\System32\Macromed\Flash\mms.cfg");
            if (!checkRegex(text, new string[] { @"SilentAutoUpdateEnable\s*=\s*1", @"AutoUpdateDisable\s*=\s*0" })){
                debugConsole("[-] mms.cfg is being repaired now!");
                string mms = "AutoUpdateDisable=0\r\nSilentAutoUpdateEnable=1\r\n";
                System.IO.File.WriteAllText(arch == "win64" ? @"C:\Windows\SysWOW64\Macromed\Flash\mms.cfg" : @"C:\Windows\System32\Macromed\Flash\mms.cfg", mms, new UTF8Encoding(false));
            } else {debugConsole("[+] No problem.");}

            debugConsole("=======================");
            debugConsole("[2] Check AdobeFlashPlayerUpdateSvc Service.");
            if (!ServiceController.GetServices().Any(serviceController => serviceController.ServiceName.Equals("AdobeFlashPlayerUpdateSvc"))){
                debugConsole("[-] Not found. The Service is being created now!");
                executeCommand("sc.exe", "create AdobeFlashPlayerUpdateSvc"
                                        + @" binPath= ""C:\WINDOWS\System32\Macromed\Flash\FlashPlayerUpdateService.exe"""
                                        + @" DisplayName= ""Adobe Flash Player Update Service"""
                                        + @" start= auto");
                executeCommand("sc.exe", @"description AdobeFlashPlayerUpdateSvc ""Create by ililililil.tistory.com""");
            } else { debugConsole("[+] No problem."); }

            debugConsole("=======================");
            debugConsole("[3] Check Adobe Flash Player Updater Task Schedule.");
            text = executeCommand("SchTasks.exe", "/Query");
            if (!checkRegex(text, new string[] { "Adobe Flash Player Updater" })){
                debugConsole("[-] Not found. The Task Schedule is being created now!");
                executeCommand("SchTasks.exe", "/Create"
                                           + @" /SC DAILY"
                                           + @" /TN ""Adobe Flash Player Updater"""
                                           + ((arch == "win64") ? 
                                             @" /TR ""C:\Windows\SysWOW64\Macromed\Flash\FlashPlayerUpdateService.exe""" :
                                             @" /TR ""C:\Windows\System32\Macromed\Flash\FlashPlayerUpdateService.exe"""));
                text = executeCommand("SchTasks.exe", @"/Query");
            } else { debugConsole("[+] No problem."); }

            debugConsole("=======================");
            debugConsole("[3] Check if Adobe Flash Player PPAPI is installed.");
            string[] file = Directory.GetFiles(arch == "win64" ? @"C:\Windows\SysWOW64\Macromed\Flash\" : @"C:\Windows\System32\Macromed\Flash\", "FlashUtil??_*_*_*_*_pepper.exe");
            if (file.Count(string.IsNullOrEmpty) == 0 && file.Length > 0){
                debugConsole("[+] Found! Check Adobe Flash Player PPAPI Notifier Task Schedule.");
                text = executeCommand("SchTasks.exe", "/Query");
                if (!checkRegex(text, new string[] { "Adobe Flash Player PPAPI Notifier" })){
                    debugConsole("[-] Not found. The Task Schedule is being created now!");
                    executeCommand("SchTasks.exe", "/Create"
                                               + @" /SC DAILY"
                                               + @" /TN ""Adobe Flash Player PPAPI Notifier"""
                                               + @" /TR """ + file[0] + @" -check pepperplugin""");
                    text = executeCommand("SchTasks.exe", @"/Query");
                } else { debugConsole("[+] Found! No problem"); }
            } else { debugConsole("[+] No found. No problem"); }

            debugConsole("=======================");
            debugConsole("[4] Finally! Execute FlashPlayerUpdateService.exe!");
            executeCommand(arch == "win64" ? @"C:\Windows\SysWOW64\Macromed\Flash\FlashPlayerUpdateService.exe" : @"C:\Windows\System32\Macromed\Flash\FlashPlayerUpdateService.exe");
            debugConsole("[+] Done!");
        }
        static void debugConsole(string text){
            Console.WriteLine("[DEBUG] " + text);
        }

        static bool checkRegex(string text, string[] patterns){
            List ret = new List();
            foreach(string pat in patterns){
                ret.Add(System.Text.RegularExpressions.Regex.IsMatch(text, pat));
            }
            return ret.All(x => x);
        }
        static string executeCommand(string executeFile, string param=""){
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                startInfo.FileName = executeFile;
                startInfo.Arguments = param;
                startInfo.UseShellExecute = false;
                startInfo.RedirectStandardOutput = true;
                startInfo.CreateNoWindow = true;
            process.StartInfo = startInfo;
            process.Start();
            string ret = process.StandardOutput.ReadToEnd();
            process.WaitForExit();
            process.Close();
            return ret;
        }
    }
}

# 이런건 매뉴얼에 적어놔야되는거 아닌가... 29버전 매뉴얼되니까 관련된 문구가 보이긴하는데 명확하지는 않은것 같다.

[매뉴얼] https://www.adobe.com/devnet/flashplayer/articles/flash_player_admin_guide.html

via me.me

반응형

블로그의 정보

정윤상이다.

담배맛구마

활동하기