Malware Devil

Tuesday, May 4, 2021

Quick and dirty Python: masscan, (Tue, May 4th)

Those who know me are aware that I am a recovering shell programmer.  I have 35+ years of various shell scripts involving complicated code pipelines with grep, cut, sort, uniq, awk, input files, output files, redirects, pipes etc…cobbled together to get jobs done. None of it is elegant and little of it could be called pretty. The last couple of years I have been trying to ramp up on Python and am increasingly finding that these complicated shell code scripts can be elegantly implemented in Python. The resulting code is way easier to read and way more supportable.

A simple example of this is the various scripts I have around as simple port scanners used to scan large swaths of IP address ranges for vulnerabilities. Since nmap is too slow for large numbers of IPs, my tool of choice for initial scanning of swaths of IPs and ports is the very speedy masscan.  masscan will find the open ports and then typically I will write the results to a file, manipulate the masscan output file to create an input file that nmap will read and then launch nmap to do the detailed scanning on the smaller set of IPs sending that output to even more files which then need to be manipulated and analyzed to extract the information I need.

Just recently I discovered there is a Python module for both masscan and nmap.   So far I have only spent time on the masscan module.  

Suppose you needed a script which will find all the web servers (port 80, 443)  in an address range.  It took me about 5 minutes to code up scan_web.py.

#!/usr/local/bin/python3
import sys,getopt,argparse
import masscan
import pprint

def main():
# read in the IP parameter
parser = argparse.ArgumentParser()
parser.add_argument(‘IP’, help=”IP address or range”)
args=parser.parse_args()
ip=args.IP

#scan address(es) using Masscan
try:
mas = masscan.PortScanner()
mas.scan(ip, ports=’80,443′)
except:
print(“Error:”, sys.exc_info()[0])
sys.exit(1)

# output result
pprint.pprint(mas.scan_result)

if __name__ == “__main__”:
main()

The script takes IP address(es) as an input and then scans those IPs using masscan to check if port 80 or 443 are open.

Running the script results in:

# ./scan_web.py 45.60.103.0,45.60.31.34
[2021-05-04 20:05:28,652] [DEBUG] [masscan.py 10 line] Scan parameters: “masscan -oX – 45.60.103.0,45.60.31.34 -p 80,443”
{‘masscan’: {‘command_line’: ‘masscan -oX – 45.60.103.0,45.60.31.34 -p 80,443’,
‘scanstats’: {‘downhosts’: ‘0’,
‘elapsed’: ’12’,
‘timestr’: ‘2021-05-04 20:05:41’,
‘totalhosts’: ‘4’,
‘uphosts’: ‘4’}},
‘scan’: {‘45.60.103.0’: {‘tcp’: {80: {‘endtime’: ‘1620158730’,
‘reason’: ‘syn-ack’,
‘reason_ttl’: ’53’,
‘services’: [],
‘state’: ‘open’},
443: {‘endtime’: ‘1620158730’,
‘reason’: ‘syn-ack’,
‘reason_ttl’: ’53’,
‘services’: [],
‘state’: ‘open’}}},
‘45.60.31.34’: {‘tcp’: {80: {‘endtime’: ‘1620158730’,
‘reason’: ‘syn-ack’,
‘reason_ttl’: ’61’,
‘services’: [],
‘state’: ‘open’},
443: {‘endtime’: ‘1620158730’,
‘reason’: ‘syn-ack’,
‘reason_ttl’: ’61’,
‘services’: [],
‘state’: ‘open’}}}}}

The result is a Python dictionary that can be easily be parsed and fed into python-nmap (an exercise for another day).

 

Caveat1: Never scan an IP range you don’t have permission to scan.  While port scanning is not illegal in most jurisdictions it is questionable ethically to scan things you don’t own or have permission to scan.

Caveat2: I am not a professional Python programmer.  My scripting gets the job done that I need it to do.  I know there are many smart people out there who can write way better code than I can. 

— Rick Wanner MSISE – rwanner at isc dot sans dot edu – Twitter:namedeplume (Protected)

(c) SANS Internet Storm Center. https://isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License. Read More

The post Quick and dirty Python: masscan, (Tue, May 4th) appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/quick-and-dirty-python-masscan-tue-may-4th/?utm_source=rss&utm_medium=rss&utm_campaign=quick-and-dirty-python-masscan-tue-may-4th

SSD Advisory – TG8 Firewall PreAuth RCE and Password Disclosure

Read More

The post SSD Advisory – TG8 Firewall PreAuth RCE and Password Disclosure appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/ssd-advisory-tg8-firewall-preauth-rce-and-password-disclosure-2/?utm_source=rss&utm_medium=rss&utm_campaign=ssd-advisory-tg8-firewall-preauth-rce-and-password-disclosure-2

[Valve] critical – OOB reads in network message handlers leads to RCE (7500.00USD)

Read More

The post [Valve] critical – OOB reads in network message handlers leads to RCE (7500.00USD) appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/valve-critical-oob-reads-in-network-message-handlers-leads-to-rce-7500-00usd-2/?utm_source=rss&utm_medium=rss&utm_campaign=valve-critical-oob-reads-in-network-message-handlers-leads-to-rce-7500-00usd-2

Exploiting the Source Engine (Part 2) – Full-Chain Client RCE in Source using Frida

Read More

The post Exploiting the Source Engine (Part 2) – Full-Chain Client RCE in Source using Frida appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/exploiting-the-source-engine-part-2-full-chain-client-rce-in-source-using-frida-2/?utm_source=rss&utm_medium=rss&utm_campaign=exploiting-the-source-engine-part-2-full-chain-client-rce-in-source-using-frida-2

Enabling Hardware-enforced Stack Protection (cetcompat) in Chrome

Read More

The post Enabling Hardware-enforced Stack Protection (cetcompat) in Chrome appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/enabling-hardware-enforced-stack-protection-cetcompat-in-chrome-2/?utm_source=rss&utm_medium=rss&utm_campaign=enabling-hardware-enforced-stack-protection-cetcompat-in-chrome-2

CVE-2021-26900: Privilege Escalation Via a Use After Free Vulnerability In win32k

Read More

The post CVE-2021-26900: Privilege Escalation Via a Use After Free Vulnerability In win32k appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/cve-2021-26900-privilege-escalation-via-a-use-after-free-vulnerability-in-win32k-2/?utm_source=rss&utm_medium=rss&utm_campaign=cve-2021-26900-privilege-escalation-via-a-use-after-free-vulnerability-in-win32k-2

Google Cloud IAM: Designs for Self-Service Privilege Escalation

Read More

The post Google Cloud IAM: Designs for Self-Service Privilege Escalation appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/google-cloud-iam-designs-for-self-service-privilege-escalation-2/?utm_source=rss&utm_medium=rss&utm_campaign=google-cloud-iam-designs-for-self-service-privilege-escalation-2

[Valve] critical – [GoldSrc] Remote Code Execution using malicious WAD list in BSP file (750.00USD)

Read More

The post [Valve] critical – [GoldSrc] Remote Code Execution using malicious WAD list in BSP file (750.00USD) appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/valve-critical-goldsrc-remote-code-execution-using-malicious-wad-list-in-bsp-file-750-00usd-2/?utm_source=rss&utm_medium=rss&utm_campaign=valve-critical-goldsrc-remote-code-execution-using-malicious-wad-list-in-bsp-file-750-00usd-2

[Valve] critical – GoldSrc: Buffer Overflow in DELTA_ParseDelta function leads to RCE (3000.00USD)

Read More

The post [Valve] critical – GoldSrc: Buffer Overflow in DELTA_ParseDelta function leads to RCE (3000.00USD) appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/valve-critical-goldsrc-buffer-overflow-in-delta_parsedelta-function-leads-to-rce-3000-00usd-2/?utm_source=rss&utm_medium=rss&utm_campaign=valve-critical-goldsrc-buffer-overflow-in-delta_parsedelta-function-leads-to-rce-3000-00usd-2

[GitHub Security Lab] high – [JAVA]: CWE-347 – Improper Verification of Cryptographic Signature : Potential for Auth Bypass

Read More

The post [GitHub Security Lab] high – [JAVA]: CWE-347 – Improper Verification of Cryptographic Signature : Potential for Auth Bypass appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/github-security-lab-high-java-cwe-347-improper-verification-of-cryptographic-signature-potential-for-auth-bypass-2/?utm_source=rss&utm_medium=rss&utm_campaign=github-security-lab-high-java-cwe-347-improper-verification-of-cryptographic-signature-potential-for-auth-bypass-2

[GitHub Security Lab] high – [Java] CWE-094: Query to detect Groovy Code Injections (4500.00USD)

Read More

The post [GitHub Security Lab] high – [Java] CWE-094: Query to detect Groovy Code Injections (4500.00USD) appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/github-security-lab-high-java-cwe-094-query-to-detect-groovy-code-injections-4500-00usd-2/?utm_source=rss&utm_medium=rss&utm_campaign=github-security-lab-high-java-cwe-094-query-to-detect-groovy-code-injections-4500-00usd-2

The Death Star’s Demise: Can You Trust Your IoT Vendors?

It was 1977, and soon-to-be-fans were greeted with a masterful score and scrolling text. Darth Vader and Princess Leia share the screen in those opening moments, and the Star Wars universe was created. Nearly 30 years later, a new film would introduce us to the events immediately preceding the “scene that launched a franchise,” but […]… Read More

The post The Death Star’s Demise: Can You Trust Your IoT Vendors? appeared first on The State of Security.

The post The Death Star’s Demise: Can You Trust Your IoT Vendors? appeared first on Security Boulevard.

Read More

The post The Death Star’s Demise: Can You Trust Your IoT Vendors? appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/the-death-stars-demise-can-you-trust-your-iot-vendors/?utm_source=rss&utm_medium=rss&utm_campaign=the-death-stars-demise-can-you-trust-your-iot-vendors

Cybersecurity Fosters Competitive Advantage

Tens of billions of dollars each year are spent on cybersecurity, yet cybercriminals continue to succeed. There seems to be a never-ending stream of cybersecurity bad news. Companies constantly experience negative security events – Facebook, Verkada, and Elekta are recent examples. Cybersecurity failures become public relations, customer relations, and financial problems for companies. The problem..

The post Cybersecurity Fosters Competitive Advantage appeared first on Security Boulevard.

Read More

The post Cybersecurity Fosters Competitive Advantage appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/cybersecurity-fosters-competitive-advantage/?utm_source=rss&utm_medium=rss&utm_campaign=cybersecurity-fosters-competitive-advantage

Experian API Leaked Credit Scores

After Experian fixed a weakness at a partner website that let anyone view credit scores for nearly every American by just inputting a name and address, questions remain about whether the same problem exists with other partners, and how widespread the problem might be. A security researcher and college student, Bill Demirkapi, stumbled across the..

The post Experian API Leaked Credit Scores appeared first on Security Boulevard.

Read More

The post Experian API Leaked Credit Scores appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/experian-api-leaked-credit-scores/?utm_source=rss&utm_medium=rss&utm_campaign=experian-api-leaked-credit-scores

A Single Security Platform That Actualizes DevSecOps

Security and Development Are Out of Synch

When bringing new applications to market, speed has become a top priority. Nearly 80% of organizations say their development team is under growing pressure to shorten release cycles. Companies are increasingly adopting DevOps tools, open-source components, and cloud-native/serverless approaches to achieve more aggressive delivery cycles.

The post A Single Security Platform That Actualizes DevSecOps appeared first on Security Boulevard.

Read More

The post A Single Security Platform That Actualizes DevSecOps appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/a-single-security-platform-that-actualizes-devsecops/?utm_source=rss&utm_medium=rss&utm_campaign=a-single-security-platform-that-actualizes-devsecops

The New Wave of Cybersecurity Awareness Training

The only constant is change. The ongoing effects of COVID-19 have taught us that change is inevitable to survive. One major area that has been affected during COVID-19 is how we interact with employees, and what we need those employees to know right now. Cybersecurity is one of those critical areas of this new world..

The post The New Wave of Cybersecurity Awareness Training appeared first on Security Boulevard.

Read More

The post The New Wave of Cybersecurity Awareness Training appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/the-new-wave-of-cybersecurity-awareness-training/?utm_source=rss&utm_medium=rss&utm_campaign=the-new-wave-of-cybersecurity-awareness-training

Third-wave AI has Proven More Effective than Traditional Cybersecurity Platforms and Methodologies

Unfortunately, the majority of cybersecurity solutions available today rely on outdated applications for AI. So-called first- and second-wave AI solutions don’t cut it, but few vendors have the technical capabilities and know-how to apply cutting edge, third-wave AI to their platforms.

The post Third-wave AI has Proven More Effective than Traditional Cybersecurity Platforms and Methodologies appeared first on Security Boulevard.

Read More

The post Third-wave AI has Proven More Effective than Traditional Cybersecurity Platforms and Methodologies appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/third-wave-ai-has-proven-more-effective-than-traditional-cybersecurity-platforms-and-methodologies/?utm_source=rss&utm_medium=rss&utm_campaign=third-wave-ai-has-proven-more-effective-than-traditional-cybersecurity-platforms-and-methodologies

The Cybersecurity Job Gap and How Getting Women in STEM can Help [Video]

As previously stated, Researchers at Cybersecurity Ventures detailed in a 2019 post there would be 3.5 million unfilled cybersecurity positions globally in 2021, but with the addition of 700,000 additional skilled practitioners according to a Cybersecurity Workforce Study that entered the field this year, the projected number has dropped to approximately 3,21 million.

The post The Cybersecurity Job Gap and How Getting Women in STEM can Help [Video] appeared first on Security Boulevard.

Read More

The post The Cybersecurity Job Gap and How Getting Women in STEM can Help [Video] appeared first on Malware Devil.



https://malwaredevil.com/2021/05/03/the-cybersecurity-job-gap-and-how-getting-women-in-stem-can-help-video/?utm_source=rss&utm_medium=rss&utm_campaign=the-cybersecurity-job-gap-and-how-getting-women-in-stem-can-help-video

ISC Stormcast For Tuesday, May 4th, 2021 https://isc.sans.edu/podcastdetail.html?id=7484, (Tue, May 4th)

(c) SANS Internet Storm Center. https://isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License. Read More

The post ISC Stormcast For Tuesday, May 4th, 2021 https://isc.sans.edu/podcastdetail.html?id=7484, (Tue, May 4th) appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/isc-stormcast-for-tuesday-may-4th-2021-https-isc-sans-edu-podcastdetail-htmlid7484-tue-may-4th/?utm_source=rss&utm_medium=rss&utm_campaign=isc-stormcast-for-tuesday-may-4th-2021-https-isc-sans-edu-podcastdetail-htmlid7484-tue-may-4th

ESB-2021.1497 – [Ubuntu] Samba: Multiple vulnerabilities

—–BEGIN PGP SIGNED MESSAGE—–
Hash: SHA256

===========================================================================
AUSCERT External Security Bulletin Redistribution

ESB-2021.1497
USN-4931-1: Samba vulnerabilities
4 May 2021

===========================================================================

AusCERT Security Bulletin Summary
———————————

Product: Samba
Publisher: Ubuntu
Operating System: Ubuntu
Impact/Access: Increased Privileges — Existing Account
Denial of Service — Existing Account
Access Confidential Data — Existing Account
Unauthorised Access — Existing Account
Reduced Security — Existing Account
Resolution: Patch/Upgrade
CVE Names: CVE-2021-20254 CVE-2020-14383 CVE-2020-14323
CVE-2020-14318

Reference: ESB-2021.1481
ESB-2021.0266
ESB-2020.4436
ESB-2020.4143
ESB-2020.3755

Original Bulletin:
https://ubuntu.com/security/notices/USN-4931-1

– ————————–BEGIN INCLUDED TEXT——————–

USN-4931-1: Samba vulnerabilities
03 May 2021

Several security issues were fixed in Samba.
Releases

o Ubuntu 14.04 ESM

Packages

o samba – SMB/CIFS file, print, and login server for Unix

Details

Steven French discovered that Samba incorrectly handled ChangeNotify
permissions. A remote attacker could possibly use this issue to obtain file
name information. ( CVE-2020-14318 )

Bas Alberts discovered that Samba incorrectly handled certain winbind
requests. A remote attacker could possibly use this issue to cause winbind
to crash, resulting in a denial of service. ( CVE-2020-14323 )

Francis Brosnan Blazquez discovered that Samba incorrectly handled certain
invalid DNS records. A remote attacker could possibly use this issue to
cause the DNS server to crash, resulting in a denial of service.
( CVE-2020-14383 )

Peter Eriksson discovered that Samba incorrectly handled certain negative
idmap cache entries. This issue could result in certain users gaining
unauthorized access to files, contrary to expected behaviour.
( CVE-2021-20254 )

Update instructions

The problem can be corrected by updating your system to the following package
versions:

Ubuntu 14.04

o samba – 2:4.3.11+dfsg-0ubuntu0.14.04.20+esm11
Available with UA Infra or UA Desktop

In general, a standard system update will make all the necessary changes.

References

o CVE-2020-14318
o CVE-2020-14323
o CVE-2020-14383
o CVE-2021-20254

Related notices

o USN-4930-1 : samba
o USN-4611-1 : samba

– ————————–END INCLUDED TEXT——————–

You have received this e-mail bulletin as a result of your organisation’s
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT’s members. As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation’s
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin. It may
not be updated when updates to the original are made. If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author’s website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above. If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

https://www.auscert.org.au/bulletins/

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

Internet Email: auscert@auscert.org.au
Facsimile: (07) 3365 7031
Telephone: (07) 3365 4417 (International: +61 7 3365 4417)
AusCERT personnel answer during Queensland business hours
which are GMT+10:00 (AEST).
On call after hours for member emergencies only.
===========================================================================
—–BEGIN PGP SIGNATURE—–
Comment: http://www.auscert.org.au/render.html?it=1967

iQIVAwUBYJB3EONLKJtyKPYoAQhHEg/5AZI27pPsNz5qn99i57iDIEjhW7K2vBsY
S7DKGlZDz2NQLz3XQmpZS9m8OdClQLIHx/1GWaoNXXNyqZFQEOXkceKy6zdUxLwq
pvrYyh9KTD2H/pYqgpA9JxO7x+jhARKW/gWl4Q4Ay/PujhnkfjkSZ2AYy3jbxynH
TcJ6KuJR4JBsl+cT+TTYdfhzIJZ8LrcHFqBhGri3nZAwDbUOLNrNuAJwkfCE22Ei
vnCO5kKNOM25yANqn3/LRL0GGmS314DXq/eKj8lY2rKc5Fxjsfb01Jta77SXaNmO
THX0R6x7PsGFkQSDqQy4rBz1uwlrjibwURDO7zZ0z+LQJHI/4YPRLr9Xyogh86Ex
lf3p0mxp8M5SFA7GcxfJN8gOdR7jCDy32DwXsYJvAM9ZCV5Fdk6xcV3yqoz82FaP
x029eVGlwtDceGVt+XC1OJph/IBC5eMOkzwdwBpI5L1u5xXasJzAYw5I46A1LfHv
MxXyLXoQ7NSSfraxKq8WheDLlVHSip9vNbvH9isA7ps4PEER26Vl2bxBV4hpul1Z
xpod22yuu6OOVIG6QwVuE4THEXRyPQOenLsN8pKw18dg4Rt03lo7S0hIqwUp3+Ra
rvMT1awpBDXS3xVCTyujiAGlMrPS1O1aj7s7AmfcMGAk0J9cznItGxzakADeehJ3
rMMKhBweNms=
=sRJb
—–END PGP SIGNATURE—–

Read More

The post ESB-2021.1497 – [Ubuntu] Samba: Multiple vulnerabilities appeared first on Malware Devil.



https://malwaredevil.com/2021/05/04/esb-2021-1497-ubuntu-samba-multiple-vulnerabilities/?utm_source=rss&utm_medium=rss&utm_campaign=esb-2021-1497-ubuntu-samba-multiple-vulnerabilities

Barbary Pirates and Russian Cybercrime

In 1801, the United States had a small Navy. Thomas Jefferson deployed almost half that Navy—three frigates and a schooner—to the Barbary C...