HI
There is many method to bypass Antivirus detection!
The Best way is writing your own toolsespecailly using python language.
My question is How to protect your self againt PE portable excuteble and how we make Antivirus to detect for example metasploit payloads?

I will appriciate for yur help

Dani AI

Generated

Short expert note: is right that attackers often build or modify PE payloads; is also correct that simple signature checks are fragile. The practical defence is not a single product — it is layered controls and an incident-ready process that assume some malicious PE will arrive.

Start with prevention and hardening. Use application whitelisting (AppLocker / Microsoft Defender Application Control) so only trusted, signed binaries can run from Program Files and Windows folders. Explicitly block execution from user-writable locations and removable media (Temp, %APPDATA%, downloads, USB). Enforce least privilege for users and disable automatic macro/script execution in email clients. Keep OS and apps patched and protect code-signing keys; treat unsigned or unknown-signer binaries as high risk.

Improve detection and response. Deploy an EDR that looks for behavior (process injection, suspicious child processes, persistence changes, unusual DNS/beacons) rather than only signatures. Route suspicious attachments through a sandbox/detonation service before delivery. Log and alert on execution from atypical paths and on uncommon outbound connections; tune firewall/egress rules to reduce noisy internet access. For small environments, enable cloud-delivered protection and tamper protection in your endpoint product.

A short triage checklist for any suspicious PE:

  • Isolate the host and disable network egress.
  • Capture file metadata and compute a hash (example: Get-FileHash -Algorithm SHA256 .\suspicious.exe).
  • Submit to a sandbox/VirusTotal for behavioral indicators and collect IOCs.
  • Block the IOCs and the file hash at perimeter/EDR; investigate lateral movement.
  • Restore from known-good backups if compromise is confirmed.

Do not run unknown payloads on production. For legitimate testing of offensive tools, use an isolated lab with documented scope and coordination. Defensive investment in policy, observability, and a practiced IR playbook gives far more protection than relying on signatures alone.

Member Avatar for Member #954384

Hi Tony75, if you generate a regular payload using msfvenom with a reverse_TCP connection it should be detected by most antiviruses. However, it is when we use software to remove all of the bad characters that cause detection when the exe is scanned that makes it harder to detect and easier to bypass. Another way is putting junk code into the executable to avoid the AV from picking it up as well. There is really no sure fire way to prevent tools like Veil-evasion or Shellter from practically making the code safe from being detected as malicious by antiviruses. However, we can stop the meterpreter session from occuring. Fortunately there is an awesome firewall that can help us with that called ZoneAlarm.
Turn everything to high in basic firewall settings and you are set for intrusion detection and prevention.

Antivirus companies are hiring people to create these types of viruses in hopes to put a stop to it, but the unfortunate thing is that there are SO many methods to bypass AV as you said, that it makes it nearly impossible to prevent these types of malware from intruding your system and everyone elses. Hope this helps. :)

Hi
Thanks for your answer
By the way ,What you mean with junk code "Another way is putting junk code into the executable to avoid the AV from picking it up "?
Maybe its more intressting!

Member Avatar for Member #954384

Think about what a polymorphic virus is. An attacker will usually put junk code into an executable (code that really doesn't need to be there, usually malicious) into the executable upon creation. Usually the bad code or junk code is encrypted, leaving the good safe code being the only thing the antivirus reads when it scans the executable and reads it as safe, because it cannot detect the bad code because it is encrypted. The reason this works is because EVERY company now a days will encrypt their software to avoid people from reverse engineering their software to obtain license keys or other secret information that they would not want anyone to know about.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.