How can I fix “CVE-2023-42364 busybox/busybox Use After Free” vulnerability in node:alpine for Next.js application?

I have the following Dockerfile for my Next.js application:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>FROM node:alpine AS base
# 2) Install dependencies only when needed.
FROM base AS deps
# 3) Install packages with no cache
RUN apk add --no-cache libc6-compat
# 4) Install dependencies based on the preferred package manager
WORKDIR /app
COPY package.json ./
RUN npm update && npm install
# 5) Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# 6) Build the code
RUN npm run build
# 7) Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
# 8) Set the correct permission for prerender cache.
RUN mkdir .next
RUN chown nextjs:nodejs .next
# 9) Reduce the Image size
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# 10) Expose the port
USER nextjs
EXPOSE 3000
ENV PORT 3000
# 11) server.js is created by next build from the standalone output
CMD ["node", "server.js"]
</code>
<code>FROM node:alpine AS base # 2) Install dependencies only when needed. FROM base AS deps # 3) Install packages with no cache RUN apk add --no-cache libc6-compat # 4) Install dependencies based on the preferred package manager WORKDIR /app COPY package.json ./ RUN npm update && npm install # 5) Rebuild the source code only when needed FROM base AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . # 6) Build the code RUN npm run build # 7) Production image, copy all the files and run next FROM base AS runner WORKDIR /app ENV NODE_ENV production RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs COPY --from=builder /app/public ./public # 8) Set the correct permission for prerender cache. RUN mkdir .next RUN chown nextjs:nodejs .next # 9) Reduce the Image size COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static # 10) Expose the port USER nextjs EXPOSE 3000 ENV PORT 3000 # 11) server.js is created by next build from the standalone output CMD ["node", "server.js"] </code>
FROM node:alpine AS base

# 2) Install dependencies only when needed.
FROM base AS deps

# 3) Install packages with no cache
RUN apk add --no-cache libc6-compat

# 4) Install dependencies based on the preferred package manager
WORKDIR /app

COPY package.json ./

RUN npm update && npm install


# 5) Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# 6) Build the code
RUN npm run build

# 7) Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# 8) Set the correct permission for prerender cache.
RUN mkdir .next
RUN chown nextjs:nodejs .next

# 9) Reduce the Image size
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

# 10) Expose the port
USER nextjs

EXPOSE 3000

ENV PORT 3000

# 11) server.js is created by next build from the standalone output
CMD ["node", "server.js"]

Snyk gives me the following vulnerability:

  • busybox/busybox Use After Free
  • Medium vulnerability
  • https://security.snyk.io/vuln/SNYK-ALPINE320-BUSYBOX-7233533

The fix is to “Upgrade Alpine:3.20 busybox to version 1.36.1-r29 or higher.”, but I am using the latest node:alphine, without specifying a version in my Dockerfile?

How can I fix this vulnerability?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật