!8 sync LTS branch to update nmap verison to 7.80

Merge pull request !8 from eaglegai/master
This commit is contained in:
openeuler-ci-bot 2020-06-29 10:37:11 +08:00 committed by Gitee
commit 9464f35fd7
4 changed files with 26 additions and 112 deletions

View File

@ -1,38 +0,0 @@
From 350bbe0597d37ad67abe5fef8fba984707b4e9ad Mon Sep 17 00:00:00 2001
From: dmiller <dmiller@e0a8ed71-7df4-0310-8962-fdc924857419>
Date: Thu, 29 Nov 2018 17:42:09 +0000
Subject: [PATCH] Avoid a crash (double-free) when SSH connection fails
---
nse_libssh2.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nse_libssh2.cc b/nse_libssh2.cc
index 6a18c0c85b..983f83dbdb 100644
--- a/nse_libssh2.cc
+++ b/nse_libssh2.cc
@@ -13,7 +13,6 @@
#include "libssh2.h"
}
-#include "nse_debug.h"
#include "nse_nsock.h"
#include "nse_utility.h"
@@ -295,6 +294,7 @@ static int do_session_handshake (lua_State *L, int status, lua_KContext ctx) {
if (rc) {
libssh2_session_free(sshu->session);
+ sshu->session = NULL;
return luaL_error(L, "Unable to complete libssh2 handshake.");
}
@@ -478,7 +478,7 @@ static int userauth_list (lua_State *L, int status, lua_KContext ctx) {
}
/*
-* Returns list of supported authenication methods
+* Returns list of supported authentication methods
*/
static int l_userauth_list (lua_State *L) {
return userauth_list(L, 0, 0);

View File

@ -1,43 +0,0 @@
From 6d8bb6df229f7acf768bcebfe14cdc8c3dbbe92b Mon Sep 17 00:00:00 2001
From: dmiller <dmiller@e0a8ed71-7df4-0310-8962-fdc924857419>
Date: Wed, 8 Aug 2018 16:36:21 +0000
Subject: [PATCH] Set limits on PCRE matches to avoid issues like #1147
---
service_scan.cc | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/service_scan.cc b/service_scan.cc
index 1fc8056884..79e92b8f21 100644
--- a/service_scan.cc
+++ b/service_scan.cc
@@ -489,6 +489,15 @@ void ServiceProbeMatch::InitMatch(const char *matchtext, int lineno) {
if (pcre_errptr != NULL)
fatal("%s: failed to pcre_study regexp on line %d of nmap-service-probes: %s\n", __func__, lineno, pcre_errptr);
+ // Set some limits to avoid evil match cases.
+ // These are flexible; if they cause problems, increase them.
+#ifdef PCRE_ERROR_MATCHLIMIT
+ regex_extra->match_limit = 100000; // 100K
+#endif
+#ifdef PCRE_ERROR_RECURSIONLIMIT
+ regex_extra->match_limit_recursion = 10000; // 10K
+#endif
+
free(modestr);
free(flags);
@@ -568,6 +577,12 @@ const struct MatchDetails *ServiceProbeMatch::testMatch(const u8 *buf, int bufle
if (o.debugging || o.verbose > 1)
error("Warning: Hit PCRE_ERROR_MATCHLIMIT when probing for service %s with the regex '%s'", servicename, matchstr);
} else
+#endif // PCRE_ERROR_MATCHLIMIT
+#ifdef PCRE_ERROR_RECURSIONLIMIT
+ if (rc == PCRE_ERROR_RECURSIONLIMIT) {
+ if (o.debugging || o.verbose > 1)
+ error("Warning: Hit PCRE_ERROR_RECURSIONLIMIT when probing for service %s with the regex '%s'", servicename, matchstr);
+ } else
#endif // PCRE_ERROR_MATCHLIMIT
if (rc != PCRE_ERROR_NOMATCH) {
fatal("Unexpected PCRE error (%d) when probing for service %s with the regex '%s'", rc, servicename, matchstr);

View File

@ -1,24 +1,20 @@
%global _hardened_build 1
Name: nmap
Epoch: 2
Version: 7.70
Release: 12
License: Nmap
Summary: A tool for network discovery and security auditing.
Requires: %{name}-ncat = %{epoch}:%{version}-%{release}
URL: https://nmap.org/
Source0: https://nmap.org/dist/%{name}-%{version}%{?prerelease}.tar.bz2
Name: nmap
Epoch: 2
Version: 7.80
Release: 1
License: Nmap
Summary: A tool for network discovery and security auditing.
Requires: %{name}-ncat = %{epoch}:%{version}-%{release}
URL: https://nmap.org/
Source0: https://nmap.org/dist/%{name}-%{version}%{?prerelease}.tar.bz2
BuildRequires: automake autoconf gcc-c++ gettext-devel libpcap-devel libssh2-devel
BuildRequires: libtool lua-devel openssl-devel pcre-devel
Patch6000: CVE-2017-18594.patch
Patch6001: CVE-2018-15173.patch
BuildRequires: gcc-c++ openssl-devel gtk2-devel lua-devel libpcap-devel pcre-devel desktop-file-utils
BuildRequires: dos2unix libtool automake autoconf gettext-devel libssh2-devel
Obsoletes: nmap-frontend nmap-ndiff nmap-ncat nc < 1.109.20120711-2
Obsoletes: nc6 < 1.00-22
Provides: nmap-frontend nmap-ndiff nmap-ncat nc nc6
Obsoletes: nmap-frontend nmap-ndiff nmap-ncat nc < 1.109.20120711-2
Obsoletes: nc6 < 1.00-22
Provides: nmap-frontend nmap-ndiff nmap-ncat nc nc6
%define pixmap_srcdir zenmap/share/pixmaps
@ -33,17 +29,10 @@ auditing. It was designed to rapidly scan large networks, but works fine against
rm -rf libpcap libpcre macosx mswin32 libssh2 libz
for f in acinclude.m4 configure.ac nping/configure.ac
do
sed -i -e 's/\(AC_DEFINE([^,)]*\))/\1, 1, [Description])/' -e 's/\(AC_DEFINE([^,]*,[^,)]*\))/\1, [Description])/' $f
done
autoreconf -I . -fiv --no-recursive
cd nping; autoreconf -I .. -fiv --no-recursive; cd ..
%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
%configure --with-libpcap=yes --with-liblua=included --without-zenmap --without-ndiff --enable-dbus --with-libssh2=yes
%configure --with-libpcap=yes --with-liblua=included --without-zenmap --without-ndiff --enable-dbus --with-libssh2=yes
%make_build
sed -i 's/-md/-mf/' nping/docs/nping.1
@ -51,21 +40,21 @@ sed -i 's/-md/-mf/' nping/docs/nping.1
%install
make DESTDIR=%{buildroot} STRIP=true install
rm -f %{buildroot}%{_datadir}/ncat/ca-bundle.crt
rmdir %{buildroot}%{_datadir}/ncat
ln -s ncat.1.gz %{buildroot}%{_mandir}/man1/nc.1.gz
ln -s ncat %{buildroot}%{_bindir}/nc
%find_lang nmap --with-man
%check
#make check
%files -f nmap.lang
%defattr(-,root,root)
%exclude %{_datadir}/ncat
%doc ncat/docs/AUTHORS ncat/docs/README
%license COPYING docs/3rd-party-licenses.txt docs/Nmap-Third-Party-Open-Source.pdf docs/Nmap-Third-Party-Open-Source.fodt docs/licenses
%license COPYING*
%{_bindir}/n*
%{_datadir}/nmap
%exclude %{_datadir}/ncat
%files help
%defattr(-,root,root)
@ -73,6 +62,12 @@ ln -s ncat %{buildroot}%{_bindir}/nc
%{_mandir}/man1/*.1.gz
%changelog
* Sun Jun 28 2020 gaihuiying <gaihuiying@huawei.com> - 2:7.80-1
- Type:requirement
- ID:NA
- SUG:NA
- DESC:sync LTS branch to update nmap to 7.80
* Wed Jun 24 2020 gaihuiying <gaihuiying1@huawei.com> - 2:7.70-12
- Type:bugfix
- ID:NA