【问题标题】:Virustotal flag 32 bit version of my program as malwareVirustotal 将我的程序的 32 位版本标记为恶意软件
【发布时间】:2016-04-27 18:04:07
【问题描述】:

我遇到了一件很奇怪的事情。我用 C# 编写了一个非常简单的程序,并尝试构建它的 32 位和 64 位版本。 64 位版本运行良好,但每当我尝试构建 32 位版本时,我的防病毒软件都会将其删除。我已将这两个文件上传到 virustotal:

32 位:https://virustotal.com/da/file/fdb3d2870ce876b49eb5d9371fc0b133b7657ddd994603777a42a47f3eb09d8b/analysis/1461779525/

64 位: https://virustotal.com/da/file/83334954cb0baef30153ca8bdfa900b64fef33f1983899c9e54e9156b72df00c/analysis/1461779699/

为什么?它的代码完全相同,唯一的区别是我在构建之前在 x64 和 x86 之间切换。

【问题讨论】:

标签: c# visual-studio x86 malware antivirus


【解决方案1】:

从代码中删除 P/Invokes 后,您可以将项目设置为 AnyCPU。这样您就不需要 x86 和 x64 构建。

我在您的项目中没有看到任何看起来不正常的东西,除了使用以下几行:

    [DllImport("psapi.dll")]
    static extern int EmptyWorkingSet(IntPtr hwProc);

    static void MinimizeFootprint()
    {
        EmptyWorkingSet(System.Diagnostics.Process.GetCurrentProcess().Handle);
    }

    ... 

    GC.Collect();
    MinimizeFootprint();

考虑到您的小型应用程序,确实不需要手动调用垃圾收集器并调整工作集。 There are known issues with using it.

当你用完它们后,只需清理你的画笔:

private void DrawResistor(PaintEventArgs e)
{
    Graphics g = e.Graphics;
    SolidBrush brs;

    //Første farve
    g.DrawLine(Pens.Black, 130, 35, 130, 109);
    g.DrawLine(Pens.Black, 140, 35, 140, 109);
    using (brs = new SolidBrush(this.Controls.Find(Farver[0], false)[0].BackColor))
    {
        g.FillRectangle(brs, 131, 35, 9, 75);
    }

    //Anden farve
    g.DrawLine(Pens.Black, 160, 44, 160, 100);
    g.DrawLine(Pens.Black, 170, 44, 170, 100);
    using (brs = new SolidBrush(this.Controls.Find(Farver[1], false)[0].BackColor))
    {
        g.FillRectangle(brs, 161, 44, 9, 56);
    }

    //Tredje farve  
    if (comboBox1.SelectedIndex != 0)
    {
        g.DrawLine(Pens.Black, 190, 44, 190, 100);
        g.DrawLine(Pens.Black, 200, 44, 200, 100);
        using (brs = new SolidBrush(this.Controls.Find(Farver[2], false)[0].BackColor))
        {
            g.FillRectangle(brs, 191, 44, 9, 56);
        }
    }

    //Fjerde farve
    g.DrawLine(Pens.Black, 220, 44, 220, 100);
    g.DrawLine(Pens.Black, 230, 44, 230, 100);
    using (brs = new SolidBrush(this.Controls.Find(Farver[3], false)[0].BackColor))
    {
        g.FillRectangle(brs, 221, 44, 9, 56);
    }

    //Femte farve
    g.DrawLine(Pens.Black, 265, 35, 265, 109);
    g.DrawLine(Pens.Black, 280, 35, 280, 109);
    using (brs = new SolidBrush(this.Controls.Find(Farver[4], false)[0].BackColor))
    {
        g.FillRectangle(brs, 266, 35, 14, 75);
    }

    //Sjette farve
    if (comboBox1.SelectedIndex == 2)
    {
        g.DrawLine(Pens.Black, 293, 35, 293, 109);
        g.DrawLine(Pens.Black, 303, 35, 303, 109);
        using (brs = new SolidBrush(this.Controls.Find(Farver[5], false)[0].BackColor))
        {
            g.FillRectangle(brs, 294, 35, 9, 75);
        }
    }
}

【讨论】:

  • 感谢您的回复!就在我发布我的代码之前,我发现我在 OnPaint 事件中设置了 picturebox1.image,这就是它当时使用近 80MB 的原因。我解决了这个问题,忘记删除对方付费电话和其他 API 调整。我已经删除了该部分,当我以 x86 作为目标重新编译时,它仍然会标记 .exe 文件。很奇怪! virustotal.com/da/file/…
  • 二进制文件看起来不错,我自己的防病毒软件也没有标记它。除了向您的防病毒供应商标记误报之外,您无能为力。 PS:你真的应该使用 using 语句来处理你的画笔。
  • 将它编译为 AnyCPU 会发生什么?据我所知,您无需专门编译为 x86 和 x64...
  • 感谢您的回复,并对我迟到的答复表示歉意。是的,AnyCPU 选项实际上工作正常。我不太清楚它是如何工作的,但我会继续阅读 :) 关于画笔,我不能把 brs.Dispose() 放在函数的末尾,而不是 using() 语句吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-27
  • 2020-10-18
  • 2014-07-11
  • 1970-01-01
  • 2016-03-05
  • 2017-05-14
相关资源
最近更新 更多