Loading...
Loading...
Identify and analyze potentially malicious software distribution repositories masquerading as legitimate security software
npx skill4agent add aradotso/security-skills avast-premium-security-detectionSkill by ara.so — Security Skills collection.
// Pattern analysis for malicious software repos
#include <string>
#include <vector>
#include <regex>
struct SuspiciousIndicator {
std::string pattern;
std::string severity; // HIGH, CRITICAL
std::string description;
};
std::vector<SuspiciousIndicator> detectMaliciousPatterns(
const std::string& repoDescription,
const std::string& repoName
) {
std::vector<SuspiciousIndicator> indicators;
// Check for crack/keygen keywords
std::vector<std::string> crackKeywords = {
"keygen", "crack", "pre-activated", "loader",
"serial", "license key", "full version", "activat"
};
for (const auto& keyword : crackKeywords) {
std::regex pattern(keyword, std::regex::icase);
if (std::regex_search(repoDescription, pattern)) {
indicators.push_back({
keyword,
"CRITICAL",
"Crack/keygen terminology detected"
});
}
}
// Check for commercial software being offered "free"
std::vector<std::string> commercialSoftware = {
"premium", "pro version", "paid software"
};
// Check for absence of legitimate code
if (repoDescription.find("README") == std::string::npos) {
indicators.push_back({
"NO_README",
"HIGH",
"No legitimate documentation present"
});
}
return indicators;
}#include <json/json.h>
#include <iostream>
class RepoSecurityAnalyzer {
public:
struct AnalysisResult {
bool isSuspicious;
std::vector<std::string> warnings;
int riskScore; // 0-100
};
AnalysisResult analyzeRepository(const Json::Value& metadata) {
AnalysisResult result{false, {}, 0};
// Check license
std::string license = metadata.get("license", "").asString();
if (license == "NOASSERTION" || license.empty()) {
result.warnings.push_back("No valid license specified");
result.riskScore += 20;
}
// Analyze star growth rate
int stars = metadata.get("stars", 0).asInt();
float starsPerDay = metadata.get("stars_per_day", 0.0).asFloat();
if (starsPerDay > 3.0 && stars < 200) {
result.warnings.push_back("Suspicious star growth pattern");
result.riskScore += 30;
}
// Check for zero forks (common in malware repos)
int forks = metadata.get("forks", 0).asInt();
if (forks == 0 && stars > 50) {
result.warnings.push_back("High stars but zero forks - artificial inflation");
result.riskScore += 25;
}
// Check topics for manipulation
Json::Value topics = metadata.get("topics", Json::arrayValue);
if (topics.size() > 5) {
result.warnings.push_back("Excessive SEO-optimized topics");
result.riskScore += 15;
}
result.isSuspicious = result.riskScore >= 50;
return result;
}
};// Example: Safe software verification workflow
#include <openssl/sha.h>
#include <fstream>
class SoftwareValidator {
public:
// Always verify against official sources
bool verifyOfficialSource(const std::string& downloadUrl) {
std::vector<std::string> officialDomains = {
"avast.com",
"avg.com" // Avast's official domains
};
for (const auto& domain : officialDomains) {
if (downloadUrl.find(domain) != std::string::npos) {
return true;
}
}
std::cerr << "WARNING: Not from official source!" << std::endl;
return false;
}
// Verify digital signature
bool verifyDigitalSignature(const std::string& filepath) {
// Use OS-specific signature verification
// Windows: Authenticode
// macOS: codesign
// Linux: gpg signatures
std::cout << "Verifying digital signature for: " << filepath << std::endl;
// Environment variable for trusted certificate
const char* trustedCert = std::getenv("TRUSTED_CERT_PATH");
if (!trustedCert) {
std::cerr << "No trusted certificate configured" << std::endl;
return false;
}
// Actual signature verification would go here
return false; // Default deny
}
};#include <curl/curl.h>
#include <string>
class MalwareReporter {
private:
std::string platformApiEndpoint;
public:
struct ReportData {
std::string repoUrl;
std::string repoOwner;
std::string repoName;
std::vector<std::string> indicators;
std::string reporterEmail;
};
bool reportToGitHub(const ReportData& data) {
// Report to GitHub's abuse team
CURL* curl = curl_easy_init();
if (!curl) return false;
std::string apiToken = std::getenv("GITHUB_TOKEN")
? std::getenv("GITHUB_TOKEN") : "";
std::string reportUrl = "https://github.com/contact/report-abuse";
// Construct abuse report
std::string reportBody =
"Repository: " + data.repoUrl + "\n" +
"Reason: Distribution of malware disguised as cracked software\n" +
"Evidence:\n";
for (const auto& indicator : data.indicators) {
reportBody += "- " + indicator + "\n";
}
std::cout << "Report generated:\n" << reportBody << std::endl;
curl_easy_cleanup(curl);
return true;
}
bool reportToAVVendor(const ReportData& data) {
// Report to Avast's abuse team
std::cout << "Contact Avast abuse team: https://www.avast.com/report-malicious-file" << std::endl;
std::cout << "Unauthorized distribution of: " << data.repoUrl << std::endl;
return true;
}
};// Configuration for legitimate sources only
struct LegitimateSource {
std::string vendor = "Avast Software";
std::string officialWebsite = "https://www.avast.com";
std::string downloadPage = "https://www.avast.com/en-us/premium-security";
bool requiresLicense = true;
bool hasFreeTrial = true;
void printInstructions() {
std::cout << "=== LEGITIMATE AVAST PREMIUM SECURITY ===" << std::endl;
std::cout << "Official website: " << officialWebsite << std::endl;
std::cout << "Download page: " << downloadPage << std::endl;
std::cout << "Free trial available: " << (hasFreeTrial ? "Yes" : "No") << std::endl;
std::cout << "\nWARNING: Never download from third-party sites!" << std::endl;
}
};#include <set>
#include <memory>
class ThreatIntelligence {
public:
// Maintain known malicious repository patterns
std::set<std::string> knownMaliciousPatterns = {
"keygen",
"crack",
"pre-activated",
"loader",
"full-version-free"
};
// Check against VirusTotal (if API key available)
bool checkVirusTotal(const std::string& repoUrl) {
const char* vtApiKey = std::getenv("VIRUSTOTAL_API_KEY");
if (!vtApiKey) {
std::cerr << "VIRUSTOTAL_API_KEY not set" << std::endl;
return false;
}
std::cout << "Checking " << repoUrl << " against VirusTotal..." << std::endl;
// Implementation would use VirusTotal API
return false;
}
};