What are the techniques to detect malware call home/beaconing
activities?
As we discussed in the comments sir, following are the broad known ways to hide malware network communications followed by ways to detect them. I have generalized some info because I am no expert in malware analysis. Hopefully below information serves help.
0> Direct IP connections, typically for malware that doesn’t make use of DNS.
Technique to detect:
- Identify the IP string and push it to a service detecting if the IP resolves to any domain and if the domain is safe/suspicious or not.
- Manually visit the IP under isolated environment and latest browser to poke around and know more.
1>Domain Generation Algorithm (DGA)
Malware with domain generation capabilities can periodically modifying C&C address details and using unknown addresses. It defeated/can defeat the Web Security Gateway (SWG), Terminal Detection Response (EDR) and Sandbox.
OR
1> Domain Name System (DNS) to resolve a C&C server address.
detection technique that may help:-
- Statistics for DNS queries on the full qualified domain name (FQDN) focusing on the second-level domain. Be aware that this can also generate lots of false positives due to content delivery networks (CDNs);
- Look for DNS responses that have a very low time to live (TTL)
- Look for Alerts on DNS queries for domains that have only recently been registered
- Look for DNS responses that have a very low time to live (TTL)
- Look for repeated requests for domains belonging to a dynamic DNS service or requests for URL shortener domains
- Look for repeated requests for domains belonging to a dynamic DNS service
- The log files of your internal DNS server are a crucial source of information.
- Note that DNS traffic itself can also be used as a communication channel
2>Host fraud
Forging header information can confuse the true destination of the data, so it can bypass defensive measures against known C&C server addresses. It defeated/can defeat the Web Security Gateway (SWG), IPS / IDS and Sandbox.
detection technique that may help:-
take following important general measures to strictly limit these malware:
Only multi-layer protective measures can achieve complete safety coverage combination of endpoint defense (such as antivirus software and network layer protection measures such as firewalls and Web security gateways) .
Focus on zero-day malware: need of malware defense mechanism that can clearly identify and detect zero-day malware.
Perform traffic analysis: the infection may come from user endpoints, attackers usually extend it to network resources. Thus consider focusing not only on a certain area or resource type, but also network in its entirety
Leveraging big data: collect massive amounts of information accumulated over time to detect malware activities worldwide and correlate seemingly unrelated activities to track the development & evolution of malware.
3> web traffic:-Corporate environments often require that users’ web traffic goes through a filtering proxy. The web proxy logs are also helpful for detecting and analyzing C&Cs.
detection technique:-
- Web requests with an unusual HTTP protocol version.
- User agents that are not commonly used in your organization.
- Do not blindly trust user agent information, however, since this can easily be crafted.
- Look for excessive size or a repeating pattern in the size of HTTP requests;
- Look for persistent connections to HTTP servers on the internet, even outside regular office hours;
- Look for repeated requests for the same web resource, possibly on different domains, with a similar parameter format;
- Look for requests to a social network site outside regular office hours.
- Some particular sample uses it's own custom protocol that it sends over SSL/TLS.
- Look for repeated requests for URL shorten-er domains;
- Security teams can spot traffic related to already-known attack campaigns by using threat intelligence feeds. Most proxies will also support block lists based on these feeds.
4>Mail:-Not all C&C communication has to be web-based; it can also happen via email.
detection technique:-
- Although email logs rarely contain the full conversation, the metadata can be helpful. Verify with your legal department under what conditions storage and access to this information is allowed and use it to look for suspicious information
5>internet relay chat (IRC) or peer to peer (P2P):-Firewall logs can shed light on other forms of C&C communication via internet relay chat (IRC) or peer to peer (P2P) exchange.
detection technique:-
- Seeing an outgoing connection attempt might be enough to tip off an investigation.
- Netflow(name is not intended to recommend a product here) statistics for workstations that establish a high number of connections or flows(this is a general tip too)
6> network steganography (a crucial tool):
(interesting irrelevant info, feel free to skip if not interested)
The secret is injected into network traffic. For example, the data can be cloaked by manipulating the content of unused flags within headers or by modulating the inter-packet time (IPT) of network flow datagrams. In the latter case, asender can encode bits of information in previously agreed-upon IPT values. Similar to the LSB modification of image’s pixels example, overly aggressive deviations would make it possible to differentiate the hiding process from normal jitter events. Therefore, hidden channels are typically characterized by a low bandwidth, often ranging from a few to a few hundreds bits per second. Today, many other methods enable covert communications among desktops or digital devices, including generating inaudible sounds or utilizing a smartphone’s sensors to receive a sequence that activates a threat
technique to detect:-
- If you have the infrastructure for recording full packet captures, this can be a very useful resource for hunting for C&Cs. Make sure the packet data is indexed and easily searchable. The searches can be based on the information previously found via the firewall logs or netflow records.
credits and respect:
https://reverseengineering.stackexchange.com/questions/22063/difficulty-obtaining-malware-traffic
https://securityintelligence.com/how-to-leverage-log-services-to-analyze-cc-traffic/
https://arxiv.org/pdf/1504.04867.pdf
One Chinese site I converted text to English from, respect for the info but unfortunately I can not mention it because it was hosted on http(not https so skeptical about recommending such site to visit.)
Hopefully this information serves help. Please feel free to edit this answer to add information or credits I missed to mention.